Debian Codegraph @

OtherLanguages/Python/setup.py

raw
1 import setuptools
2 from glob import glob
3 from os.path import basename, exists, join, getmtime
4 from shutil import copyfile
5
6 # Forces the wheel to be platform-specific (e.g., win_amd64)
7 # but compatible with any Python 3 version (py3-none).
8 try:
9 from wheel.bdist_wheel import bdist_wheel as _bdist_wheel
10 class bdist_wheel(_bdist_wheel):
11 def finalize_options(self):
12 _bdist_wheel.finalize_options(self)
13 self.root_is_pure = False
14
15 def get_tag(self):
16 _, _, plat = _bdist_wheel.get_tag(self)
17 return "py3", "none", plat
18 cmdclass = {'bdist_wheel': bdist_wheel}
19 except ImportError:
20 cmdclass = {}
21
22 readme_path = join("lerc", "README.md")
23 try:
24 with open(readme_path, "r") as fh:
25 long_description = fh.read()
26 except Exception:
27 long_description = "Limited Error Raster Compression"
28
29 # Stage binaries from repo root into package root
30 BINARY_TYPES = ["*.dll", "*.lib", "*.so*", "*.dylib"]
31 PLATFORMS = ["Linux", "MacOS", "windows"]
32 for platform in PLATFORMS:
33 platform_dir = join("..", "..", "bin", platform)
34 for ext in BINARY_TYPES:
35 input_binaries = glob(join(platform_dir, ext))
36 for input_binary in input_binaries:
37 output_binary = join("lerc", basename(input_binary))
38 if not exists(output_binary) or getmtime(input_binary) > getmtime(output_binary):
39 copyfile(input_binary, output_binary)
40
41 setuptools.setup(
42 name="pylerc",
43 version="4.1.1",
44 author="esri",
45 author_email="[email protected]",
46 description="Limited Error Raster Compression",
47 long_description=long_description,
48 long_description_content_type="text/markdown",
49 license="Apache 2",
50 url="https://github.com/Esri/lerc",
51 packages=setuptools.find_packages(),
52 install_requires=["numpy >=2.3.0,<3"],
53 cmdclass=cmdclass,
54 classifiers=[
55 "Programming Language :: Python :: 3.11",
56 "Programming Language :: Python :: 3.12",
57 "Programming Language :: Python :: 3.13",
58 "Programming Language :: Python :: 3.14",
59 "License :: OSI Approved :: Apache Software License",
60 ],
61 package_data={"lerc": BINARY_TYPES},
62 python_requires=">=3.11",
63 zip_safe=False,
64 )