forked from Median-XL/pympq
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
69 lines (58 loc) · 1.86 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import os
import shutil
import struct
from pathlib import Path
from setuptools import Extension, setup
if os.name != 'nt':
raise NotImplementedError("pympq only supports windows")
def get_version() -> str:
version = os.environ.get("PYMPQ_DIST_VERSION")
if not version:
return "0.1.dev"
return version
def get_arch() -> str:
bits = struct.calcsize("P") * 8
if bits == 64:
return "x64"
elif bits == 32:
return "x86"
else:
raise ValueError("Can't determine architecture")
# hack'ish workaround to get StormLib.dll included next
# to the generated .pyd in our installed module
shutil.copyfile(f"stormlib\\{get_arch()}\\StormLib.dll", "pympq\\StormLib.dll")
pympq_ext = Extension(
'pympq',
sources = ['src\\pympq.cpp'],
include_dirs=[f"stormlib\\{get_arch()}"],
library_dirs=[f"stormlib\\{get_arch()}"],
libraries=["StormLib", "StormLibRUD"],
extra_compile_args=["/D_UNICODE", "/DUNICODE"],
)
setup(
name='pympq',
version=get_version(),
author="Median XL",
url="https://github.com/Median-XL/pympq",
description='python implementation of the stormlib API',
classifiers=[
"Environment :: Win32 (MS Windows)",
"Operating System :: Microsoft :: Windows",
"Programming Language :: C++",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
],
ext_package="pympq",
ext_modules=[pympq_ext],
include_package_data=True,
packages = ["pympq"],
package_dir={"pympq": "pympq"},
package_data={
"pympq": ["*.dll"],
},
)