dfhack/library/python/deprecated/setup.py

60 lines
2.1 KiB
Python

2010-04-02 13:09:37 -06:00
# -*- coding: utf-8 -*-
2010-05-02 21:06:46 -06:00
try:
from setuptools import setup, find_packages
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
from distutils.core import Extension
from os import path
2010-05-04 22:28:34 -06:00
import platform
if platform.system() == 'Windows':
# dfhack.lib location can differ, search for it
for libdir in ["..", path.join("..",".."), path.join("..", "..", "output"), path.join("..", "..", "output", "Release")]:
if path.isfile(path.join(libdir, "dfhack.lib")):
lib_dirs = libdir
2010-05-05 03:33:44 -06:00
libraries=["dfhack"]
break
if path.isfile(path.join(libdir, "libdfhack.dll")):
lib_dirs = libdir
libraries = ["libdfhack"]
2010-05-04 22:28:34 -06:00
break
else:
raise Exception("dfhack.lib is not found")
2010-05-05 03:33:44 -06:00
osspec = dict(library_dirs=[lib_dirs],
libraries=libraries)
2010-05-04 22:28:34 -06:00
elif platform.system() == 'Linux':
osspec = dict(extra_compile_args=["-DLINUX_BUILD", "-w"],
2010-05-05 03:33:44 -06:00
library_dirs=[path.join("..","..","output")],
libraries=["dfhack"])
e = Extension("pydfhack._pydfhack",
2010-05-04 22:28:34 -06:00
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=["../", path.join("..", "include"), path.join("..","depends","md5"), path.join("..","depends","tinyxml")],
export_symbols=["init_pydfhack", "ReadRaw", "WriteRaw"],
**osspec)
for file in ["Memory.xml", path.join("..","..","output","Memory.xml")]:
if path.isfile(file):
datafile = file
break
else:
2010-05-04 22:28:34 -06:00
raise Exception("Memory.xml is not found.")
2010-05-02 21:06:46 -06:00
setup(
name="PyDFHack",
description="Python wrapper and bindings for DFHack library",
version="1.0",
packages=find_packages(exclude=['ez_setup']),
data_files=[('pydfhack', [datafile])],
2010-05-02 21:06:46 -06:00
include_package_data=True,
test_suite='nose.collector',
zip_safe=False,
ext_modules=[e],
)