|
16 | 16 | # limitations under the License. |
17 | 17 | ################################################################################ |
18 | 18 |
|
19 | | -from setuptools import setup |
20 | | - |
21 | | -PACKAGES = [ |
22 | | - 'paimon_python_api', |
23 | | - 'java_based_implementation', |
24 | | - 'java_based_implementation.util' |
25 | | -] |
26 | | - |
27 | | -install_requires = [ |
28 | | - 'py4j==0.10.9.7', |
29 | | - 'python-dateutil>=2.8.0,<3', |
30 | | - 'pytz>=2018.3', |
31 | | - 'numpy>=1.22.4', |
32 | | - 'pandas>=1.3.0', |
33 | | - 'pyarrow>=5.0.0' |
34 | | -] |
35 | | - |
36 | | -setup( |
37 | | - name='paimon_python', |
38 | | - version='0.9.0.dev1', |
39 | | - packages=PACKAGES, |
40 | | - install_requires=install_requires, |
41 | | - description='Apache Paimon Python API', |
42 | | - author='Apache Software Foundation', |
43 | | - author_email='dev@paimon.apache.org', |
44 | | - url='https://paimon.apache.org', |
45 | | - classifiers=[ |
46 | | - 'Development Status :: 5 - Production/Stable', |
47 | | - 'License :: OSI Approved :: Apache Software License', |
48 | | - 'Programming Language :: Python :: 3.8', |
49 | | - 'Programming Language :: Python :: 3.9', |
50 | | - 'Programming Language :: Python :: 3.10', |
51 | | - 'Programming Language :: Python :: 3.11'], |
52 | | - python_requires='>=3.8' |
53 | | -) |
| 19 | +import fnmatch |
| 20 | +import java_based_implementation.util.setup_utils |
| 21 | +import os |
| 22 | +import shutil |
| 23 | + |
| 24 | +from setuptools import Command, setup |
| 25 | + |
| 26 | + |
| 27 | +class CleanCommand(Command): |
| 28 | + description = 'Clean up temporary files and directories of last build.' |
| 29 | + user_options = [] |
| 30 | + |
| 31 | + def initialize_options(self): |
| 32 | + pass |
| 33 | + |
| 34 | + def finalize_options(self): |
| 35 | + pass |
| 36 | + |
| 37 | + def run(self): |
| 38 | + directories_to_delete = ['build', 'dist', '*.egg-info'] |
| 39 | + |
| 40 | + for directory in directories_to_delete: |
| 41 | + if '*' in directory: |
| 42 | + for matched_dir in filter(lambda x: fnmatch.fnmatch(x, directory), os.listdir('.')): |
| 43 | + if os.path.isdir(matched_dir): |
| 44 | + shutil.rmtree(matched_dir) |
| 45 | + else: |
| 46 | + if os.path.exists(directory): |
| 47 | + shutil.rmtree(directory) |
| 48 | + |
| 49 | + |
| 50 | +try: |
| 51 | + PACKAGES = [ |
| 52 | + 'paimon_python_api', |
| 53 | + 'java_based_implementation', |
| 54 | + 'java_based_implementation.util' |
| 55 | + ] |
| 56 | + |
| 57 | + PACKAGE_DATA = { |
| 58 | + 'java_based_implementation': java_based_implementation.util.setup_utils.get_package_data() |
| 59 | + } |
| 60 | + |
| 61 | + install_requires = [ |
| 62 | + 'py4j==0.10.9.7', |
| 63 | + 'python-dateutil>=2.8.0,<3', |
| 64 | + 'pytz>=2018.3', |
| 65 | + 'numpy>=1.22.4', |
| 66 | + 'pandas>=1.3.0', |
| 67 | + 'pyarrow>=5.0.0' |
| 68 | + ] |
| 69 | + |
| 70 | + setup( |
| 71 | + name='paimon_python', |
| 72 | + version='0.9.0.dev1', |
| 73 | + packages=PACKAGES, |
| 74 | + include_package_data=True, |
| 75 | + package_data=PACKAGE_DATA, |
| 76 | + cmdclass={'clean': CleanCommand}, |
| 77 | + install_requires=install_requires, |
| 78 | + description='Apache Paimon Python API', |
| 79 | + author='Apache Software Foundation', |
| 80 | + author_email='dev@paimon.apache.org', |
| 81 | + url='https://paimon.apache.org', |
| 82 | + classifiers=[ |
| 83 | + 'Development Status :: 5 - Production/Stable', |
| 84 | + 'License :: OSI Approved :: Apache Software License', |
| 85 | + 'Programming Language :: Python :: 3.8', |
| 86 | + 'Programming Language :: Python :: 3.9', |
| 87 | + 'Programming Language :: Python :: 3.10', |
| 88 | + 'Programming Language :: Python :: 3.11'], |
| 89 | + python_requires='>=3.8' |
| 90 | + ) |
| 91 | +finally: |
| 92 | + java_based_implementation.util.setup_utils.clean() |
0 commit comments