Some fixes for compiling, setup and importing

develop
RusAnon 2010-05-03 14:12:31 +11:00
parent 021480ca9a
commit 34a8424afd
5 changed files with 14 additions and 13 deletions

1
.gitignore vendored

@ -26,3 +26,4 @@ examples/fake-curses.h
*.pyc *.pyc
dfhack/python/pydfhack/_pydfhack.so dfhack/python/pydfhack/_pydfhack.so
dfhack/python/PyDFHack.egg-info dfhack/python/PyDFHack.egg-info
dfhack/python/build

@ -62,7 +62,7 @@ static PyMethodDef module_methods[] =
{NULL} //Sentinel {NULL} //Sentinel
}; };
PyMODINIT_FUNC initpydfhack(void) PyMODINIT_FUNC init_pydfhack(void)
{ {
PyObject* module; PyObject* module;

@ -0,0 +1 @@
from .pydfapi import API

@ -1,6 +1,5 @@
import pydfhack, os import _pydfhack, os
class API(_pydfhack._API):
class API(pydfhack._API):
for file in ["Memory.xml", os.path.join("..","..","output","Memory.xml")]: for file in ["Memory.xml", os.path.join("..","..","output","Memory.xml")]:
if os.path.isfile(file): if os.path.isfile(file):
datafile = file datafile = file
@ -9,20 +8,20 @@ class API(pydfhack._API):
raise ImportError, "Memory.xml not found." raise ImportError, "Memory.xml not found."
def __init__(self, *args, **kwds): def __init__(self, *args, **kwds):
pydfhack._API.__init__(self, API.datafile) _pydfhack._API.__init__(self, API.datafile)
self._map_mgr_type = Map self._map_mgr_type = Map
self._vegetation_mgr_type = Vegetation self._vegetation_mgr_type = Vegetation
self._gui_mgr_type = GUI self._gui_mgr_type = GUI
class Map(pydfhack._MapManager): class Map(_pydfhack._MapManager):
def __init__(self, *args, **kwds): def __init__(self, *args, **kwds):
pydfhack._MapManager.__init__(self, args, kwds) _pydfhack._MapManager.__init__(self, args, kwds)
class Vegetation(pydfhack._VegetationManager): class Vegetation(_pydfhack._VegetationManager):
def __init__(self, *args, **kwds): def __init__(self, *args, **kwds):
pydfhack._VegetationManager.__init__(self, args, kwds) _pydfhack._VegetationManager.__init__(self, args, kwds)
class GUI(pydfhack._GUIManager): class GUI(_pydfhack._GUIManager):
def __init__(self, *args, **kwds): def __init__(self, *args, **kwds):
pydfhack._GUIManager.__init__(self, args, kwds) _pydfhack._GUIManager.__init__(self, args, kwds)

@ -7,13 +7,13 @@ except ImportError:
from setuptools import setup, find_packages from setuptools import setup, find_packages
from distutils.core import Extension from distutils.core import Extension
e = Extension("pydfhack", e = Extension("_pydfhack",
sources=["DF_API.cpp", "DF_Buildings.cpp", "DF_Constructions.cpp", "DF_CreatureManager.cpp", "DF_GUI.cpp", "DF_Maps.cpp", "DF_Material.cpp", "DF_Position.cpp", "DF_Translate.cpp", "DF_Vegetation.cpp", "pydfhack.cpp"], sources=["DF_API.cpp", "DF_Buildings.cpp", "DF_Constructions.cpp", "DF_CreatureManager.cpp", "DF_GUI.cpp", "DF_Maps.cpp", "DF_Material.cpp", "DF_Position.cpp", "DF_Translate.cpp", "DF_Vegetation.cpp", "pydfhack.cpp"],
include_dirs=["../", "../include", "../depends/md5", "../depends/tinyxml"], include_dirs=["../", "../include", "../depends/md5", "../depends/tinyxml"],
library_dirs=["..\\..\\output"], library_dirs=["..\\..\\output"],
#extra_compile_args=["-w"], #extra_compile_args=["-w"],
libraries=["libdfhack"], libraries=["libdfhack"],
export_symbols=["initpydfhack", "ReadRaw", "WriteRaw"]) export_symbols=["init_pydfhack", "ReadRaw", "WriteRaw"])
setup( setup(
name="PyDFHack", name="PyDFHack",