-
-
Notifications
You must be signed in to change notification settings - Fork 138
/
setup.py
executable file
·94 lines (76 loc) · 2.9 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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""The setup script."""
import os
import platform
import sys
from typing import List
from setuptools import find_packages
from setuptools import setup
from setuptools.dist import Distribution
from setuptools.command.build_ext import build_ext
CONDA_PREFIX = os.environ.get("CONDA_PREFIX", None)
WORKING_DIR = os.getcwd()
class Build(build_ext):
"""Customized setuptools build command - builds protos on build."""
def run(self):
if platform.system() != "Linux":
# For Windows and Mac setup.py is not used for wheel build but the
# build is performed from GitHub actions files. The special
# treatment for Linux is required because wheel build is performed
# inside manylinux Docker images with the help of cibuildwheel
# (https://github.com/pypa/cibuildwheel). Building with manylinux
# ensures that PyDP can work on old Linux versions.
return
# Build _pydp.so (wrappers for C++).
os.system("./build_PyDP_linux.sh")
# Copy _pydp.so to cibuildwheel directory.
pydp_lib = "src/pydp/_pydp.so"
version_str = f"{sys.version_info.major}{sys.version_info.minor}"
destination_dir = f"build/lib.linux-x86_64-cpython-{version_str}/pydp"
os.system(f"cp {pydp_lib} {destination_dir}")
build_ext.run(self)
class BinaryDistribution(Distribution):
"""This class is needed in order to create OS specific wheels."""
def has_ext_modules(self):
return True
def read(fname):
with open(os.path.join(os.path.dirname(__file__), fname), encoding="utf-8") as fp:
return fp.read()
requirements: List[str] = []
setup_requirements: List[str] = []
setup(
author="Chinmay Shah",
author_email="chinmayshah3899@gmail.com",
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Natural Language :: English",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
],
cmdclass={"build_ext": Build},
description="Python API for Google's Differential Privacy library",
distclass=BinaryDistribution,
install_requires=requirements,
license="Apache-2.0",
long_description=read("docs/readme.rst"),
long_description_content_type="text/x-rst",
include_package_data=True,
keywords="pydp",
name="python-dp",
package_dir={"": "src"},
package_data={
"pydp": ["_pydp.so", "_pydp.pyd"],
},
packages=find_packages(where="src", exclude=["tests"]),
setup_requires=setup_requirements,
python_requires=">=3.8",
test_suite="tests",
url="https://github.com/OpenMined/PyDP",
version="1.1.5.rc4",
zip_safe=False,
)