forked from decisionforce/pgdrive
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
97 lines (75 loc) · 3.01 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# Please don't change the order of following packages!
import sys
from setuptools import find_namespace_packages # This should be place at top!
from distutils.core import setup
from distutils.extension import Extension
from os import path
import numpy
from Cython.Build import cythonize
assert sys.version_info.major == 3 and sys.version_info.minor >= 6, "python version >= 3.6 is required"
this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
packages = find_namespace_packages(
exclude=("docs", "docs.*", "documentation", "documentation.*", "pgdrive.assets.*", "build.*"))
print("We will install the following packages: ", packages)
""" ===== Remember to modify the PG_EDITION at first ====="""
version = "0.1.4"
ext_modules = cythonize([Extension(
"pgdrive.cutils", ["pgdrive/cutils.pyx"], include_dirs=[numpy.get_include()]
)])
for ele in ext_modules:
assert isinstance(ele, Extension)
setup(
name="pgdrive",
version=version,
description="An open-ended driving simulator with infinite scenes",
url="https://github.com/decisionforce/pgdrive",
author="PGDrive Team",
author_email="[email protected], [email protected]",
packages=packages,
install_requires=[
"gym",
"numpy<=1.19.3",
"matplotlib",
"pandas",
"pygame",
"yapf==0.30.0",
"seaborn",
"panda3d~=1.10.8",
"panda3d-gltf",
"panda3d-simplepbr",
"pillow",
"pytest",
"opencv-python-headless",
"Cython==0.29.6"
],
include_package_data=True,
license="Apache 2.0",
long_description=long_description,
long_description_content_type='text/markdown',
ext_modules=ext_modules
)
msg = """
If you encounter the following error:
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
Please feel free to continue! We will disable cython utility and fall back to all python code. Please enjoy!
"""
print(msg)
"""
How to publish to pypi? Noted by Zhenghao in Dec 27, 2020.
1. Remove old files
rm -rf dist/ build/ documentation/build/ pgdrive.egg-info/ docs/build/
2. Rename current version to X.Y.Z.rcA, where A is arbitrary value represent "release candidate A".
This is really important since pypi do not support renaming and re-uploading.
3. Get wheel
python setup.py sdist bdist_wheel
WARNING: wheel should not be created on windows, since assets will not be included in the .whl file !!!
4. Upload to test channel
twine upload --repository testpypi dist/*
5. Test as next line. If failed, change the version name and repeat 1, 2, 3, 4, 5.
pip install --index-url https://test.pypi.org/simple/ pgdrive
6. Rename current version to X.Y.Z in setup.py, rerun 1, 3 steps.
7. Upload to production channel
twine upload dist/*
"""