Apply PEP 517.
parent
fb5e731e6e
commit
d8c69901d3
|
@ -1,3 +1,3 @@
|
|||
include requirements.txt
|
||||
include pyproject.toml setup.cfg
|
||||
include README.md
|
||||
recursive-include . *.h *.c
|
||||
|
|
|
@ -21,7 +21,10 @@ pip install python-solvespace
|
|||
Build and install the module:
|
||||
|
||||
```bash
|
||||
python setup.py install
|
||||
pip install python-solvespace
|
||||
# From repository
|
||||
git submodule update --init
|
||||
pip install -e .
|
||||
```
|
||||
|
||||
Run unit tests:
|
||||
|
|
|
@ -16,8 +16,9 @@ echo compiler=%COMPILER%>> "%DISTUTILS%"
|
|||
echo patched file "%DISTUTILS%"
|
||||
REM Apply the patch of "cygwinccompiler.py".
|
||||
REM Unix "patch" command of Msys.
|
||||
patch -N "%PYTHON_DIR%\lib\distutils\cygwinccompiler.py" "%HERE%\cygwinccompiler.diff"
|
||||
patch -N "%PYTHON_DIR%\include\pyconfig.h" "%HERE%\pyconfig.diff"
|
||||
set patch="C:\Program Files\Git\usr\bin\patch.exe"
|
||||
%patch% -N "%PYTHON_DIR%\lib\distutils\cygwinccompiler.py" "%HERE%\cygwinccompiler.diff"
|
||||
%patch% -N "%PYTHON_DIR%\include\pyconfig.h" "%HERE%\pyconfig.diff"
|
||||
|
||||
REM Copy "vcruntime140.dll" to "libs".
|
||||
copy "%PYTHON_DIR%\vcruntime140.dll" "%PYTHON_DIR%\libs"
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
[build-system]
|
||||
requires = ["wheel", "setuptools"]
|
||||
build-backend = "setuptools.build_meta"
|
|
@ -1 +0,0 @@
|
|||
cython
|
|
@ -0,0 +1,46 @@
|
|||
[metadata]
|
||||
name = python_solvespace
|
||||
version = attr: python_solvespace.__version__
|
||||
description = Python library of Solvespace.
|
||||
long_description = file: README.md
|
||||
long_description_content_type = text/markdown
|
||||
keywords = cad,mechanical-engineering,2d,3d
|
||||
license = GPLv3+
|
||||
author = Yuan Chang
|
||||
author_email = pyslvs@gmail.com
|
||||
url = https://github.com/KmolYuan/solvespace
|
||||
classifiers =
|
||||
Programming Language :: Python :: 3.6
|
||||
Programming Language :: Python :: 3.7
|
||||
Programming Language :: Python :: 3.8
|
||||
Programming Language :: Python :: 3.9
|
||||
Programming Language :: Cython
|
||||
Topic :: Scientific/Engineering
|
||||
License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
|
||||
Operating System :: OS Independent
|
||||
Typing :: Typed
|
||||
|
||||
[options]
|
||||
zip_safe = False
|
||||
packages = find:
|
||||
python_requires = >=3.6
|
||||
setup_requires =
|
||||
cython
|
||||
|
||||
[options.package_data]
|
||||
* = *.pyi, *.pxd, *.pyx
|
||||
python_solvespace = py.typed
|
||||
|
||||
[options.packages.find]
|
||||
exclude =
|
||||
test
|
||||
|
||||
[mypy]
|
||||
pretty = True
|
||||
show_error_codes = True
|
||||
show_column_numbers = True
|
||||
ignore_missing_imports = True
|
||||
allow_redefinition = True
|
||||
warn_redundant_casts = True
|
||||
warn_unreachable = True
|
||||
strict_equality = True
|
|
@ -10,9 +10,7 @@ __email__ = "pyslvs@gmail.com"
|
|||
import sys
|
||||
from os import walk
|
||||
from os.path import dirname, isdir, join
|
||||
import re
|
||||
import codecs
|
||||
from setuptools import setup, Extension, find_packages
|
||||
from setuptools import setup, Extension
|
||||
from setuptools.command.build_ext import build_ext
|
||||
from setuptools.command.sdist import sdist
|
||||
from distutils import file_util, dir_util
|
||||
|
@ -27,25 +25,6 @@ mimalloc_path = join(extlib_path, 'mimalloc')
|
|||
mimalloc_include_path = join(mimalloc_path, 'include')
|
||||
mimalloc_src_path = join(mimalloc_path, 'src')
|
||||
build_dir = 'build'
|
||||
|
||||
|
||||
def write(doc, *parts):
|
||||
with codecs.open(join(*parts), 'w') as f:
|
||||
f.write(doc)
|
||||
|
||||
|
||||
def read(*parts):
|
||||
with codecs.open(join(*parts), 'r') as f:
|
||||
return f.read()
|
||||
|
||||
|
||||
def find_version(*file_paths):
|
||||
m = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", read(*file_paths), re.M)
|
||||
if m:
|
||||
return m.group(1)
|
||||
raise RuntimeError("Unable to find version string.")
|
||||
|
||||
|
||||
macros = [
|
||||
('M_PI', 'PI'),
|
||||
('_USE_MATH_DEFINES', None),
|
||||
|
@ -90,8 +69,9 @@ mimalloc_sources = [
|
|||
join(mimalloc_src_path, 'stats.c'),
|
||||
join(mimalloc_src_path, 'random.c'),
|
||||
join(mimalloc_src_path, 'os.c'),
|
||||
join(mimalloc_src_path, 'bitmap.c'),
|
||||
join(mimalloc_src_path, 'arena.c'),
|
||||
join(mimalloc_src_path, 'region.c'),
|
||||
join(mimalloc_src_path, 'segment-cache.c'),
|
||||
join(mimalloc_src_path, 'segment.c'),
|
||||
join(mimalloc_src_path, 'page.c'),
|
||||
join(mimalloc_src_path, 'alloc.c'),
|
||||
|
@ -139,6 +119,7 @@ def copy_source(dry_run):
|
|||
|
||||
|
||||
class Build(build_ext):
|
||||
|
||||
def build_extensions(self):
|
||||
compiler = self.compiler.compiler_type
|
||||
for e in self.extensions:
|
||||
|
@ -178,6 +159,7 @@ class Build(build_ext):
|
|||
|
||||
|
||||
class PackSource(sdist):
|
||||
|
||||
def run(self):
|
||||
copy_source(self.dry_run)
|
||||
super(PackSource, self).run()
|
||||
|
@ -187,34 +169,10 @@ class PackSource(sdist):
|
|||
dir_util.remove_tree(extlib_path, dry_run=self.dry_run)
|
||||
|
||||
|
||||
setup(
|
||||
name="python_solvespace",
|
||||
version=find_version(m_path, '__init__.py'),
|
||||
author=__author__,
|
||||
author_email=__email__,
|
||||
description="Python library of Solvespace.",
|
||||
long_description=read("README.md"),
|
||||
long_description_content_type='text/markdown',
|
||||
url="https://github.com/KmolYuan/solvespace",
|
||||
packages=find_packages(exclude=('test',)),
|
||||
package_data={'': ["*.pyi", "*.pxd"], 'python_solvespace': ['py.typed']},
|
||||
ext_modules=[Extension(
|
||||
"python_solvespace.slvs",
|
||||
sources,
|
||||
language="c++",
|
||||
include_dirs=[include_path, src_path, mimalloc_include_path, mimalloc_src_path]
|
||||
)],
|
||||
cmdclass={'build_ext': Build, 'sdist': PackSource},
|
||||
zip_safe=False,
|
||||
python_requires=">=3.6",
|
||||
install_requires=read('requirements.txt').splitlines(),
|
||||
test_suite='test',
|
||||
classifiers=[
|
||||
"Programming Language :: Python :: 3.6",
|
||||
"Programming Language :: Python :: 3.7",
|
||||
"Programming Language :: Python :: 3.8",
|
||||
"Programming Language :: Cython",
|
||||
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
|
||||
"Operating System :: OS Independent",
|
||||
]
|
||||
)
|
||||
setup(ext_modules=[Extension(
|
||||
"python_solvespace.slvs",
|
||||
sources,
|
||||
language="c++",
|
||||
include_dirs=[include_path, src_path, mimalloc_include_path,
|
||||
mimalloc_src_path]
|
||||
)], cmdclass={'build_ext': Build, 'sdist': PackSource})
|
||||
|
|
Loading…
Reference in New Issue