|
18 | 18 | # under the License. |
19 | 19 | # |
20 | 20 |
|
21 | | -import platform |
22 | | -from distutils.command import build_ext |
| 21 | +from setuptools import setup |
23 | 22 | from distutils.core import Extension |
24 | 23 | from os import environ, path |
| 24 | +import platform |
25 | 25 |
|
26 | | -from setuptools import setup |
| 26 | +from distutils.command import build_ext |
27 | 27 |
|
28 | 28 |
|
29 | 29 | def get_version(): |
30 | 30 | root = path.dirname(path.realpath(__file__)) |
31 | | - version_file = path.join(root, "pulsar", "__about__.py") |
| 31 | + version_file = path.join(root, 'pulsar', '__about__.py') |
32 | 32 | version = {} |
33 | 33 | with open(version_file) as fp: |
34 | 34 | exec(fp.read(), version) |
35 | | - return version["__version__"] |
| 35 | + return version['__version__'] |
36 | 36 |
|
37 | 37 |
|
38 | 38 | def get_name(): |
39 | | - postfix = environ.get("NAME_POSTFIX", "") |
40 | | - base = "pulsar-client" |
| 39 | + postfix = environ.get('NAME_POSTFIX', '') |
| 40 | + base = 'pulsar-client' |
41 | 41 | return base + postfix |
42 | 42 |
|
43 | 43 |
|
44 | 44 | VERSION = get_version() |
45 | 45 | NAME = get_name() |
46 | 46 |
|
47 | | -print("NAME: %s" % NAME) |
48 | | -print("VERSION: %s" % VERSION) |
| 47 | +print('NAME: %s' % NAME) |
| 48 | +print('VERSION: %s' % VERSION) |
49 | 49 |
|
50 | 50 |
|
51 | 51 | # This is a workaround to have setuptools to include |
52 | 52 | # the already compiled _pulsar.so library |
53 | 53 | class my_build_ext(build_ext.build_ext): |
54 | 54 | def build_extension(self, ext): |
55 | | - import os.path |
56 | 55 | import shutil |
| 56 | + import os.path |
57 | 57 |
|
58 | 58 | try: |
59 | 59 | os.makedirs(os.path.dirname(self.get_ext_fullpath(ext.name))) |
60 | 60 | except OSError as e: |
61 | 61 | if e.errno != 17: # already exists |
62 | 62 | raise |
63 | | - if "Windows" in platform.platform(): |
64 | | - shutil.copyfile("_pulsar.pyd", self.get_ext_fullpath(ext.name)) |
| 63 | + if 'Windows' in platform.platform(): |
| 64 | + shutil.copyfile('_pulsar.pyd', self.get_ext_fullpath(ext.name)) |
65 | 65 | else: |
66 | 66 | try: |
67 | | - shutil.copyfile("_pulsar.so", self.get_ext_fullpath(ext.name)) |
| 67 | + shutil.copyfile('_pulsar.so', self.get_ext_fullpath(ext.name)) |
68 | 68 | except FileNotFoundError: |
69 | | - shutil.copyfile("lib_pulsar.so", self.get_ext_fullpath(ext.name)) |
| 69 | + shutil.copyfile('lib_pulsar.so', self.get_ext_fullpath(ext.name)) |
70 | 70 |
|
71 | 71 |
|
72 | 72 | # Core Client dependencies |
73 | 73 | dependencies = [ |
74 | | - "certifi", |
| 74 | + 'certifi', |
75 | 75 | ] |
76 | 76 |
|
77 | 77 | extras_require = {} |
78 | 78 |
|
79 | 79 | # functions dependencies |
80 | 80 | extras_require["functions"] = sorted( |
81 | 81 | { |
82 | | - "protobuf>=3.6.1", |
83 | | - "grpcio>=1.59.3", |
84 | | - "apache-bookkeeper-client>=4.16.1", |
85 | | - "prometheus_client", |
86 | | - "ratelimit", |
| 82 | + "protobuf>=3.6.1", |
| 83 | + "grpcio>=1.59.3", |
| 84 | + "apache-bookkeeper-client>=4.16.1", |
| 85 | + "prometheus_client", |
| 86 | + "ratelimit" |
87 | 87 | } |
88 | 88 | ) |
89 | 89 |
|
90 | 90 | # avro dependencies |
91 | | -extras_require["avro"] = sorted({"fastavro>=1.9.2"}) |
| 91 | +extras_require["avro"] = sorted( |
| 92 | + { |
| 93 | + "fastavro>=1.9.2" |
| 94 | + } |
| 95 | +) |
92 | 96 |
|
93 | 97 | # all dependencies |
94 | 98 | extras_require["all"] = sorted(set(sum(extras_require.values(), []))) |
95 | 99 |
|
96 | 100 | setup( |
97 | 101 | name=NAME, |
98 | 102 | version=VERSION, |
99 | | - packages=["pulsar", "pulsar.schema", "pulsar.functions"], |
100 | | - cmdclass={"build_ext": my_build_ext}, |
101 | | - ext_modules=[Extension("_pulsar", [])], |
| 103 | + packages=['pulsar', 'pulsar.schema', 'pulsar.functions'], |
| 104 | + cmdclass={'build_ext': my_build_ext}, |
| 105 | + ext_modules=[Extension('_pulsar', [])], |
| 106 | + |
102 | 107 | author="Pulsar Devs", |
103 | 108 | author_email="dev@pulsar.apache.org", |
104 | 109 | description="Apache Pulsar Python client library", |
|
0 commit comments