Fix the distribution from sources.
parent
4f034441c2
commit
989008e3e9
|
@ -1,117 +1,17 @@
|
|||
# cython
|
||||
/CMakeCache.txt
|
||||
/build*/
|
||||
/test/**/*.diff.*
|
||||
/test/**/*.curr.*
|
||||
*.trace
|
||||
/debian/tmp/
|
||||
/debian/*.log
|
||||
/debian/*.substvars
|
||||
/debian/*.debhelper
|
||||
/debian/files
|
||||
/debian/solvespace/
|
||||
/debian/libslvs1/
|
||||
/debian/libslvs1-dev/
|
||||
/obj-*/
|
||||
/*.slvs
|
||||
.idea/*
|
||||
python_solvespace/*.cpp
|
||||
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
*.o*
|
||||
*.cxx
|
||||
*.def
|
||||
*.lib
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
env/
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
AppImageAssistant
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
.hypothesis/
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
local_settings.py
|
||||
|
||||
# Flask stuff:
|
||||
instance/
|
||||
.webassets-cache
|
||||
|
||||
# Scrapy stuff:
|
||||
.scrapy
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
# PyBuilder
|
||||
target/
|
||||
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints
|
||||
|
||||
# pyenv
|
||||
.python-version
|
||||
|
||||
# celery beat schedule file
|
||||
celerybeat-schedule
|
||||
|
||||
# SageMath parsed files
|
||||
*.sage.py
|
||||
|
||||
# dotenv
|
||||
.env
|
||||
|
||||
# virtualenv
|
||||
.venv
|
||||
venv/
|
||||
ENV/
|
||||
out/
|
||||
|
||||
# Spyder project settings
|
||||
.spyderproject
|
||||
.spyproject
|
||||
|
||||
# Rope project settings
|
||||
.ropeproject
|
||||
|
||||
# mkdocs documentation
|
||||
/site
|
||||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
|
||||
#PyCharm cache
|
||||
.idea/
|
||||
|
||||
# Others
|
||||
.DS_Store
|
||||
*/.DS_Store
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
include requirements.txt
|
||||
include README.md
|
||||
recursive-include . *.h
|
||||
|
|
Binary file not shown.
|
@ -0,0 +1,3 @@
|
|||
#ifndef SOLVESPACE_CONFIG_H
|
||||
#define SOLVESPACE_CONFIG_H
|
||||
#endif
|
|
@ -0,0 +1,57 @@
|
|||
Metadata-Version: 2.1
|
||||
Name: python-solvespace
|
||||
Version: 3.0.0.post2
|
||||
Summary: Python library of Solvespace
|
||||
Home-page: https://github.com/KmolYuan/solvespace
|
||||
Author: Yuan Chang
|
||||
Author-email: pyslvs@gmail.com
|
||||
License: UNKNOWN
|
||||
Description: [![Version](https://img.shields.io/badge/version-3.0.0-yellow.svg)](https://github.com/KmolYuan/solvespace/releases/latest)
|
||||
[![Build status](https://ci.appveyor.com/api/projects/status/b2o8jw7xnfqghqr5?svg=true)](https://ci.appveyor.com/project/KmolYuan/solvespace)
|
||||
[![Build status](https://img.shields.io/travis/KmolYuan/solvespace.svg?logo=travis)](https://travis-ci.org/KmolYuan/solvespace)
|
||||
[![PyPI](https://img.shields.io/pypi/v/python-solvespace.svg)](https://pypi.org/project/python-solvespace/)
|
||||
[![GitHub license](https://img.shields.io/badge/license-GPLv3+-blue.svg)](https://raw.githubusercontent.com/KmolYuan/solvespace/master/LICENSE)
|
||||
|
||||
# python-solvespace
|
||||
|
||||
Python library from solver of SolveSpace.
|
||||
|
||||
+ [Python API](https://pyslvs-ui.readthedocs.io/en/stable/python-solvespace-api/)
|
||||
+ [C API](https://github.com/solvespace/solvespace/blob/master/exposed/DOC.txt)
|
||||
|
||||
# Install
|
||||
|
||||
```bash
|
||||
pip install python-solvespace
|
||||
```
|
||||
|
||||
# Build and Test (Repository)
|
||||
|
||||
Build and install the module:
|
||||
|
||||
```bash
|
||||
python setup.py install
|
||||
```
|
||||
|
||||
Run unit test:
|
||||
|
||||
```bash
|
||||
python tests
|
||||
```
|
||||
|
||||
Uninstall the module:
|
||||
|
||||
```bash
|
||||
pip uninstall python-solvespace
|
||||
```
|
||||
|
||||
[GNU Make]: https://sourceforge.net/projects/mingw-w64/files/latest/download?source=files
|
||||
[Cython]: https://cython.org/
|
||||
|
||||
Platform: UNKNOWN
|
||||
Classifier: Programming Language :: Python :: 3
|
||||
Classifier: Programming Language :: Cython
|
||||
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
|
||||
Classifier: Operating System :: OS Independent
|
||||
Requires-Python: >=3.6
|
||||
Description-Content-Type: text/markdown
|
|
@ -0,0 +1,53 @@
|
|||
MANIFEST.in
|
||||
README.md
|
||||
requirements.txt
|
||||
setup.py
|
||||
./platform/config.h
|
||||
./python_solvespace/include/slvs.h
|
||||
./python_solvespace/src/dsc.h
|
||||
./python_solvespace/src/expr.h
|
||||
./python_solvespace/src/polygon.h
|
||||
./python_solvespace/src/resource.h
|
||||
./python_solvespace/src/sketch.h
|
||||
./python_solvespace/src/solvespace.h
|
||||
./python_solvespace/src/ttf.h
|
||||
./python_solvespace/src/ui.h
|
||||
./python_solvespace/src/platform/gui.h
|
||||
./python_solvespace/src/platform/platform.h
|
||||
./python_solvespace/src/render/gl3shader.h
|
||||
./python_solvespace/src/render/render.h
|
||||
./python_solvespace/src/srf/surface.h
|
||||
platform/config.h
|
||||
python_solvespace/__init__.pxd
|
||||
python_solvespace/__init__.py
|
||||
python_solvespace/slvs.pxd
|
||||
python_solvespace/slvs.pyi
|
||||
python_solvespace/slvs.pyx
|
||||
python_solvespace.egg-info/PKG-INFO
|
||||
python_solvespace.egg-info/SOURCES.txt
|
||||
python_solvespace.egg-info/dependency_links.txt
|
||||
python_solvespace.egg-info/requires.txt
|
||||
python_solvespace.egg-info/top_level.txt
|
||||
python_solvespace/include/slvs.h
|
||||
python_solvespace/src/constraint.cpp
|
||||
python_solvespace/src/constrainteq.cpp
|
||||
python_solvespace/src/dsc.h
|
||||
python_solvespace/src/entity.cpp
|
||||
python_solvespace/src/expr.cpp
|
||||
python_solvespace/src/expr.h
|
||||
python_solvespace/src/lib.cpp
|
||||
python_solvespace/src/polygon.h
|
||||
python_solvespace/src/resource.h
|
||||
python_solvespace/src/sketch.h
|
||||
python_solvespace/src/solvespace.h
|
||||
python_solvespace/src/system.cpp
|
||||
python_solvespace/src/ttf.h
|
||||
python_solvespace/src/ui.h
|
||||
python_solvespace/src/util.cpp
|
||||
python_solvespace/src/platform/gui.h
|
||||
python_solvespace/src/platform/platform.cpp
|
||||
python_solvespace/src/platform/platform.h
|
||||
python_solvespace/src/platform/utilwin.cpp
|
||||
python_solvespace/src/render/gl3shader.h
|
||||
python_solvespace/src/render/render.h
|
||||
python_solvespace/src/srf/surface.h
|
|
@ -0,0 +1 @@
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
setuptools
|
||||
wheel
|
||||
cython
|
|
@ -0,0 +1 @@
|
|||
python_solvespace
|
|
@ -8,7 +8,7 @@ __author__ = "Yuan Chang"
|
|||
__copyright__ = "Copyright (C) 2016-2019"
|
||||
__license__ = "GPLv3+"
|
||||
__email__ = "pyslvs@gmail.com"
|
||||
__version__ = "3.0.0.post2"
|
||||
__version__ = "3.0.0.post3"
|
||||
|
||||
from .slvs import (
|
||||
quaternion_u,
|
||||
|
|
|
@ -7,24 +7,26 @@ __copyright__ = "Copyright (C) 2016-2019"
|
|||
__license__ = "GPLv3+"
|
||||
__email__ = "pyslvs@gmail.com"
|
||||
|
||||
import os
|
||||
from os.path import (
|
||||
abspath,
|
||||
dirname,
|
||||
isdir,
|
||||
join as pth_join,
|
||||
)
|
||||
import re
|
||||
import codecs
|
||||
from textwrap import dedent
|
||||
from setuptools import setup, Extension, find_packages
|
||||
from setuptools.command.build_ext import build_ext
|
||||
from setuptools.command.sdist import sdist
|
||||
from distutils import dir_util
|
||||
from platform import system
|
||||
from distutils import sysconfig
|
||||
|
||||
here = abspath(dirname(__file__))
|
||||
include_path = '../include/'
|
||||
src_path = '../src/'
|
||||
platform_path = src_path + 'platform/'
|
||||
include_path = pth_join('python_solvespace', 'include')
|
||||
src_path = pth_join('python_solvespace', 'src')
|
||||
platform_path = pth_join(src_path, 'platform')
|
||||
extra_path = pth_join(here, 'platform')
|
||||
ver = sysconfig.get_config_var('VERSION')
|
||||
lib = sysconfig.get_config_var('BINDIR')
|
||||
|
||||
|
@ -66,14 +68,14 @@ compile_args = [
|
|||
]
|
||||
|
||||
sources = [
|
||||
'python_solvespace/' + 'slvs.pyx',
|
||||
src_path + 'util.cpp',
|
||||
src_path + 'entity.cpp',
|
||||
src_path + 'expr.cpp',
|
||||
src_path + 'constrainteq.cpp',
|
||||
src_path + 'constraint.cpp',
|
||||
src_path + 'system.cpp',
|
||||
src_path + 'lib.cpp',
|
||||
pth_join('python_solvespace', 'slvs.pyx'),
|
||||
pth_join(src_path, 'util.cpp'),
|
||||
pth_join(src_path, 'entity.cpp'),
|
||||
pth_join(src_path, 'expr.cpp'),
|
||||
pth_join(src_path, 'constrainteq.cpp'),
|
||||
pth_join(src_path, 'constraint.cpp'),
|
||||
pth_join(src_path, 'system.cpp'),
|
||||
pth_join(src_path, 'lib.cpp'),
|
||||
]
|
||||
|
||||
if system() == 'Windows':
|
||||
|
@ -87,23 +89,32 @@ if system() == 'Windows':
|
|||
macros.append(('WIN32', None))
|
||||
|
||||
# Platform sources
|
||||
sources.append(platform_path + 'utilwin.cpp')
|
||||
sources.append(platform_path + 'platform.cpp')
|
||||
sources.append(pth_join(platform_path, 'utilwin.cpp'))
|
||||
sources.append(pth_join(platform_path, 'platform.cpp'))
|
||||
else:
|
||||
sources.append(platform_path + 'utilunix.cpp')
|
||||
sources.append(pth_join(platform_path, 'utilunix.cpp'))
|
||||
|
||||
|
||||
class Build(build_ext):
|
||||
def run(self):
|
||||
# Generate "config.h", actually not used.
|
||||
config_h = src_path + "config.h"
|
||||
write(dedent(f"""\
|
||||
#ifndef SOLVESPACE_CONFIG_H
|
||||
#define SOLVESPACE_CONFIG_H
|
||||
#endif
|
||||
"""), config_h)
|
||||
has_src = isdir(include_path) and isdir(src_path)
|
||||
if not has_src:
|
||||
dir_util.copy_tree(pth_join('..', 'include'), include_path)
|
||||
dir_util.copy_tree(pth_join('..', 'src'), src_path)
|
||||
super(Build, self).run()
|
||||
os.remove(config_h)
|
||||
if not has_src:
|
||||
dir_util.remove_tree(include_path, dry_run=self.dry_run)
|
||||
dir_util.remove_tree(src_path, dry_run=self.dry_run)
|
||||
|
||||
|
||||
class PackSource(sdist):
|
||||
def run(self):
|
||||
dir_util.copy_tree(pth_join('..', 'include'), include_path)
|
||||
dir_util.copy_tree(pth_join('..', 'src'), src_path)
|
||||
super(PackSource, self).run()
|
||||
if not self.keep_temp:
|
||||
dir_util.remove_tree(include_path, dry_run=self.dry_run)
|
||||
dir_util.remove_tree(src_path, dry_run=self.dry_run)
|
||||
|
||||
|
||||
setup(
|
||||
|
@ -116,16 +127,16 @@ setup(
|
|||
long_description_content_type='text/markdown',
|
||||
url="https://github.com/KmolYuan/solvespace",
|
||||
packages=find_packages(exclude=('tests',)),
|
||||
package_data={'': ["*.pyi"]},
|
||||
package_data={'': ["*.pyi", "*.pxd"]},
|
||||
ext_modules=[Extension(
|
||||
"python_solvespace.slvs",
|
||||
sources,
|
||||
language="c++",
|
||||
include_dirs=[include_path, src_path, platform_path],
|
||||
include_dirs=[include_path, src_path, platform_path, extra_path],
|
||||
define_macros=macros,
|
||||
extra_compile_args=compile_args
|
||||
)],
|
||||
cmdclass={'build_ext': Build},
|
||||
cmdclass={'build_ext': Build, 'sdist': PackSource},
|
||||
python_requires=">=3.6",
|
||||
install_requires=read('requirements.txt').splitlines(),
|
||||
test_suite="tests",
|
||||
|
|
Loading…
Reference in New Issue