fixes for the python stuff
							parent
							
								
									07f8c442b9
								
							
						
					
					
						commit
						3c9ac77581
					
				| @ -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 -*- | # -*- coding: utf-8 -*- | ||||||
| from distutils.core import setup, Extension | from distutils.core import setup, Extension | ||||||
|  | from os import path | ||||||
| 
 | 
 | ||||||
| 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=["../", path.join("..", "include"), path.join("..","depends","md5"), path.join("..","depends","tinyxml")], | ||||||
| 	library_dirs=["../../output"], | 	library_dirs=[path.join("..","..","output")], | ||||||
|         extra_compile_args=["-DLINUX_BUILD"], |     extra_compile_args=["-DLINUX_BUILD", "-w"], | ||||||
| 	libraries=["dfhack-debug"], | 	libraries=["dfhack"], | ||||||
|         export_symbols=["initpydfhack", "ReadRaw", "WriteRaw"]) |     export_symbols=["initpydfhack", "ReadRaw", "WriteRaw"]) | ||||||
| 
 | 
 | ||||||
| setup(name="PyDFHack", version="1.0", ext_modules=[e]) | setup(name="PyDFHack", version="1.0", ext_modules=[e]) | ||||||
|  | |||||||
| @ -1,21 +1,28 @@ | |||||||
| from pydfhack import * | import pydfhack, os | ||||||
| 
 | 
 | ||||||
| class API(_API): | class API(pydfhack._API): | ||||||
|     def __init__(self, *args, **kwds): | 	for file in ["Memory.xml", os.path.join("..","..","output","Memory.xml")]: | ||||||
|         _API.__init__(self, args, kwds) | 		if os.path.isfile(file): | ||||||
|  | 			datafile = file | ||||||
|  | 			break | ||||||
|  | 	else: | ||||||
|  | 		raise ImportError, "Memory.xml not found." | ||||||
| 	 | 	 | ||||||
|         self._map_mgr_type = Map | 	def __init__(self, *args, **kwds): | ||||||
|         self._vegetation_mgr_type = Vegetation | 		pydfhack._API.__init__(self, API.datafile) | ||||||
|         self._gui_mgr_type = GUI |  | ||||||
| 		 | 		 | ||||||
| class Map(_MapManager): | 		self._map_mgr_type = Map | ||||||
|     def __init__(self, *args, **kwds): | 		self._vegetation_mgr_type = Vegetation | ||||||
|         _MapManager.__init__(self, args, kwds) | 		self._gui_mgr_type = GUI | ||||||
| 
 | 
 | ||||||
| class Vegetation(_VegetationManager): | class Map(pydfhack._MapManager): | ||||||
|     def __init__(self, *args, **kwds): | 	def __init__(self, *args, **kwds): | ||||||
|         _VegetationManager.__init__(self, args, kwds) | 		pydfhack._MapManager.__init__(self, args, kwds) | ||||||
| 
 | 
 | ||||||
| class GUI(_GUIManager): | class Vegetation(pydfhack._VegetationManager): | ||||||
|     def __init__(self, *args, **kwds): | 	def __init__(self, *args, **kwds): | ||||||
|         _GUIManager.__init__(self, args, kwds) | 		pydfhack._VegetationManager.__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 -*- | # -*- 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" | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue