develop
Petr Mrázek 2010-05-02 00:51:14 +02:00
commit a7e4b6dba4
4 changed files with 42 additions and 23 deletions

@ -0,0 +1,4 @@
#!/bin/bash
python linsetup.py build_ext
cp build/lib.linux-i686-2.6/pydfhack.so .
rm -r build

@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-
from distutils.core import setup, Extension
from os import path
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"],
include_dirs=["../", "../include", "../depends/md5", "../depends/tinyxml"],
library_dirs=["../../output"],
extra_compile_args=["-DLINUX_BUILD"],
libraries=["dfhack-debug"],
export_symbols=["initpydfhack", "ReadRaw", "WriteRaw"])
include_dirs=["../", path.join("..", "include"), path.join("..","depends","md5"), path.join("..","depends","tinyxml")],
library_dirs=[path.join("..","..","output")],
extra_compile_args=["-DLINUX_BUILD", "-w"],
libraries=["dfhack"],
export_symbols=["initpydfhack", "ReadRaw", "WriteRaw"])
setup(name="PyDFHack", version="1.0", ext_modules=[e])

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

@ -1,2 +1,9 @@
# -*- coding: utf-8 -*-
import pydfhack
import pydfapi
print "Attempting to initialize pydfhack...",
DF = pydfapi.API()
Map = pydfapi.Map()
Vegetation = pydfapi.Vegetation()
GUI = pydfapi.GUI()
print "OK"