forked from zackmark29/Chrome2209-CDM-API
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.py
40 lines (34 loc) · 864 Bytes
/
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
import shutil
from pathlib import Path
from setuptools import setup, Extension
name = 'cdmapi'
src = 'cdmapi_src'
setup(
name=name,
version="1.0.0",
ext_modules=[
Extension(
name=name,
sources=[
f'{src}/bind.cpp',
f'{src}/codelift.cpp'
],
extra_objects=[f'{src}/cryptlib.lib'],
# to use for any python version
py_limited_api=True,
define_macros=[('Py_LIMITED_API', None)]
)
]
)
for folder in ('build', 'cdmapi.egg-info'):
if Path(folder).exists():
print(f'Deleting {folder} folder and files')
shutil.rmtree(folder)
dist = Path('dist')
if dist.exists():
try:
whl = next(dist.glob('*.whl'))
whl.rename(whl.name)
dist.rmdir()
except StopIteration:
pass