Reduce the source files of Solvespace.

pull/493/head
KmolYuan 2019-09-27 14:18:22 +08:00
parent 989008e3e9
commit 88d828546c
9 changed files with 138 additions and 123 deletions

116
cython/.gitignore vendored
View File

@ -13,5 +13,119 @@
/debian/libslvs1-dev/ /debian/libslvs1-dev/
/obj-*/ /obj-*/
/*.slvs /*.slvs
.idea/*
python_solvespace/*.cpp 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

Binary file not shown.

View File

@ -1,57 +0,0 @@
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

View File

@ -1,53 +0,0 @@
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

View File

@ -1,3 +0,0 @@
setuptools
wheel
cython

View File

@ -1 +0,0 @@
python_solvespace

View File

@ -8,7 +8,7 @@ __author__ = "Yuan Chang"
__copyright__ = "Copyright (C) 2016-2019" __copyright__ = "Copyright (C) 2016-2019"
__license__ = "GPLv3+" __license__ = "GPLv3+"
__email__ = "pyslvs@gmail.com" __email__ = "pyslvs@gmail.com"
__version__ = "3.0.0.post3" __version__ = "3.0.0.post4"
from .slvs import ( from .slvs import (
quaternion_u, quaternion_u,

View File

@ -7,6 +7,7 @@ __copyright__ = "Copyright (C) 2016-2019"
__license__ = "GPLv3+" __license__ = "GPLv3+"
__email__ = "pyslvs@gmail.com" __email__ = "pyslvs@gmail.com"
from os import walk
from os.path import ( from os.path import (
abspath, abspath,
dirname, dirname,
@ -18,7 +19,7 @@ import codecs
from setuptools import setup, Extension, find_packages from setuptools import setup, Extension, find_packages
from setuptools.command.build_ext import build_ext from setuptools.command.build_ext import build_ext
from setuptools.command.sdist import sdist from setuptools.command.sdist import sdist
from distutils import dir_util from distutils import file_util, dir_util
from platform import system from platform import system
from distutils import sysconfig from distutils import sysconfig
@ -26,7 +27,7 @@ here = abspath(dirname(__file__))
include_path = pth_join('python_solvespace', 'include') include_path = pth_join('python_solvespace', 'include')
src_path = pth_join('python_solvespace', 'src') src_path = pth_join('python_solvespace', 'src')
platform_path = pth_join(src_path, 'platform') platform_path = pth_join(src_path, 'platform')
extra_path = pth_join(here, 'platform') extra_path = 'platform'
ver = sysconfig.get_config_var('VERSION') ver = sysconfig.get_config_var('VERSION')
lib = sysconfig.get_config_var('BINDIR') lib = sysconfig.get_config_var('BINDIR')
@ -95,12 +96,27 @@ else:
sources.append(pth_join(platform_path, 'utilunix.cpp')) sources.append(pth_join(platform_path, 'utilunix.cpp'))
def copy_source(dry_run):
dir_util.copy_tree(pth_join('..', 'include'), include_path, dry_run=dry_run)
dir_util.mkpath(pth_join('python_solvespace', 'src'))
for root, _, files in walk(pth_join('..', 'src')):
for f in files:
if not f.endswith('.h'):
continue
f = pth_join(root, f)
f_new = f.replace('..', 'python_solvespace')
if not isdir(dirname(f_new)):
dir_util.mkpath(dirname(f_new))
file_util.copy_file(f, f_new, dry_run=dry_run)
for f in sources[1:]:
file_util.copy_file(f.replace('python_solvespace', '..'), f, dry_run=dry_run)
class Build(build_ext): class Build(build_ext):
def run(self): def run(self):
has_src = isdir(include_path) and isdir(src_path) has_src = isdir(include_path) and isdir(src_path)
if not has_src: if not has_src:
dir_util.copy_tree(pth_join('..', 'include'), include_path) copy_source(self.dry_run)
dir_util.copy_tree(pth_join('..', 'src'), src_path)
super(Build, self).run() super(Build, self).run()
if not has_src: if not has_src:
dir_util.remove_tree(include_path, dry_run=self.dry_run) dir_util.remove_tree(include_path, dry_run=self.dry_run)
@ -109,8 +125,7 @@ class Build(build_ext):
class PackSource(sdist): class PackSource(sdist):
def run(self): def run(self):
dir_util.copy_tree(pth_join('..', 'include'), include_path) copy_source(self.dry_run)
dir_util.copy_tree(pth_join('..', 'src'), src_path)
super(PackSource, self).run() super(PackSource, self).run()
if not self.keep_temp: if not self.keep_temp:
dir_util.remove_tree(include_path, dry_run=self.dry_run) dir_util.remove_tree(include_path, dry_run=self.dry_run)
@ -137,6 +152,7 @@ setup(
extra_compile_args=compile_args extra_compile_args=compile_args
)], )],
cmdclass={'build_ext': Build, 'sdist': PackSource}, cmdclass={'build_ext': Build, 'sdist': PackSource},
zip_safe=False,
python_requires=">=3.6", python_requires=">=3.6",
install_requires=read('requirements.txt').splitlines(), install_requires=read('requirements.txt').splitlines(),
test_suite="tests", test_suite="tests",