|
- #!/usr/bin/env python3
- # -*- coding: utf-8; mode: python; tab-width: 4; indent-tabs-mode: nil -*-
- # vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 fileencoding=utf-8
-
- import os
- import sys
- import platform
- from setuptools import setup, find_packages
- from setuptools.dist import Distribution
- import sysconfig
-
-
- __author__ = ['"donkey" <anjingyu_ws@foxmail.com>']
-
-
- class BinaryDistribution(Distribution):
- """Distribution which always forces a binary package with platform name"""
- def has_ext_modules(foo):
- return True
-
-
- def ext_name():
- name = "_dbcc"
-
- if platform.system() == "Windows":
- name = name + ".pyd"
- elif platform.system() == "Darwin":
- name = name + ".dylib"
- else:
- name = name + ".so"
-
- return name
-
-
- def other_deps():
- if platform.system() == "Windows":
- result = []
- script_dir = os.path.dirname(os.path.abspath(__file__))
- for file in os.listdir(os.path.join(script_dir, 'dbcc')):
- file_lower = file.lower()
- if file_lower.endswith(".dll") or file_lower.endswith(".pyd"):
- result.append(file)
- return result
- else:
- return []
-
- def main():
- setup(name='dbcc',
- version='@DBCC_VERSION@',
- description="DBCC Python extension",
- long_description="DBCC Python extension",
- keywords="DBCC",
- author="donkey",
- author_email="<anjingyu_ws@foxmail.com>",
- classifiers=[
- 'Programming Language :: Python :: 3.13',
- 'Programming Language :: Python :: 3.12',
- 'Programming Language :: Python :: 3.11',
- 'Programming Language :: Python :: 3.10',
- 'Programming Language :: Python :: 3.9',
- 'Programming Language :: Python :: 3.8',
- 'Programming Language :: Python :: 3.7',
- 'Programming Language :: Python :: 3.6',
- 'Development Status :: 5 - Production/Stable',
- 'Intended Audience :: Developers',
- 'Operating System :: Microsoft :: Windows' if platform.system() == "Windows" else 'Operating System :: POSIX :: Linux'
- ],
- python_requires="~=@PYTHON_VERSION_MAJOR@.@PYTHON_VERSION_MINOR@",
- license="MIT",
- packages=find_packages(),
- package_data={
- "dbcc": [ext_name()] + other_deps()
- },
- # The following lines are the same
- # distclass=BinaryDistribution,
- has_ext_modules=lambda: True,
- include_package_data=True,
- zip_safe=False)
-
- if __name__ == '__main__':
- main()
|