|
1 | | -from setuptools import setup, find_packages |
| 1 | +from setuptools import setup, find_packages, Command |
| 2 | +import os |
| 3 | +import sys |
| 4 | +import pygem |
2 | 5 |
|
| 6 | +# Package meta-data. |
| 7 | +NAME = pygem.__title__ |
| 8 | +DESCRIPTION = 'Python Geometrical Morphing.' |
| 9 | +URL = 'https://github.com/mathLab/PyGeM' |
| 10 | +MAIL = pygem.__mail__ |
| 11 | +AUTHOR = pygem.__author__ |
| 12 | +VERSION = pygem.__version__ |
| 13 | +KEYWORDS='dimension_reduction mathematics ffd morphing iges stl vtk openfoam' |
3 | 14 |
|
4 | | -def readme(): |
5 | | - """ |
6 | | - This function just return the content of README.md |
7 | | - """ |
8 | | - with open('README.md') as f: |
9 | | - return f.read() |
| 15 | +REQUIRED = [ |
| 16 | + 'future', 'numpy', 'scipy', 'matplotlib', |
| 17 | +] |
10 | 18 |
|
| 19 | +EXTRAS = { |
| 20 | + 'docs': ['Sphinx==1.4', 'sphinx_rtd_theme'], |
| 21 | +} |
| 22 | + |
| 23 | +LDESCRIPTION = ( |
| 24 | + "PyGeM is a python package using Free Form Deformation, Radial Basis " |
| 25 | + "Functions and Inverse Distance Weighting to parametrize and morph complex " |
| 26 | + "geometries. It is ideally suited for actual industrial problems, since it " |
| 27 | + "allows to handle:\n" |
| 28 | + "1) Computer Aided Design files (in .iges, .step, and .stl formats) Mesh " |
| 29 | + "files (in .unv and OpenFOAM formats)\n" |
| 30 | + "2) Output files (in .vtk format)\n" |
| 31 | + "3) LS-Dyna Keyword files (.k format).\n" |
| 32 | + "\n" |
| 33 | + "By now, it has been used with meshes with up to 14 milions of cells. Try " |
| 34 | + "with more and more complicated input files! See the Examples section " |
| 35 | + "below and the Tutorials to have an idea of the potential of this package." |
| 36 | +) |
| 37 | + |
| 38 | +here = os.path.abspath(os.path.dirname(__file__)) |
| 39 | +class UploadCommand(Command): |
| 40 | + """Support setup.py upload.""" |
| 41 | + |
| 42 | + description = 'Build and publish the package.' |
| 43 | + user_options = [] |
| 44 | + |
| 45 | + @staticmethod |
| 46 | + def status(s): |
| 47 | + """Prints things in bold.""" |
| 48 | + print('\033[1m{0}\033[0m'.format(s)) |
| 49 | + |
| 50 | + def initialize_options(self): |
| 51 | + pass |
| 52 | + |
| 53 | + def finalize_options(self): |
| 54 | + pass |
| 55 | + |
| 56 | + def run(self): |
| 57 | + try: |
| 58 | + self.status('Removing previous builds...') |
| 59 | + rmtree(os.path.join(here, 'dist')) |
| 60 | + except OSError: |
| 61 | + pass |
| 62 | + |
| 63 | + self.status('Building Source and Wheel (universal) distribution...') |
| 64 | + os.system('{0} setup.py sdist bdist_wheel --universal'.format(sys.executable)) |
| 65 | + |
| 66 | + self.status('Uploading the package to PyPI via Twine...') |
| 67 | + os.system('twine upload dist/*') |
| 68 | + |
| 69 | + self.status('Pushing git tags...') |
| 70 | + os.system('git tag v{0}'.format(VERSION)) |
| 71 | + os.system('git push --tags') |
| 72 | + |
| 73 | + sys.exit() |
11 | 74 |
|
12 | 75 | setup( |
13 | | - name='pygem', |
14 | | - version='1.1', |
15 | | - description='Tools for gemetrical morphing.', |
16 | | - long_description=readme(), |
17 | | - classifiers=[ |
| 76 | + name=NAME, |
| 77 | + version=VERSION, |
| 78 | + description=DESCRIPTION, |
| 79 | + long_description=LDESCRIPTION, |
| 80 | + author=AUTHOR, |
| 81 | + author_email=MAIL, |
| 82 | + classifiers=[ |
18 | 83 | 'Development Status :: 5 - Production/Stable', |
19 | 84 | 'License :: OSI Approved :: MIT License', |
20 | | - 'Programming Language :: Python :: 2.7', |
| 85 | + 'Programming Language :: Python :: 3', |
| 86 | + 'Programming Language :: Python :: 3.7', |
21 | 87 | 'Intended Audience :: Science/Research', |
22 | 88 | 'Topic :: Scientific/Engineering :: Mathematics' |
23 | | - ], |
24 | | - keywords='dimension_reduction mathematics ffd morphing iges stl vtk openfoam', |
25 | | - url='https://github.com/mathLab/PyGeM', |
26 | | - author='Marco Tezzele, Nicola Demo', |
27 | | - |
| 89 | + ], |
| 90 | + keywords=KEYWORDS, |
| 91 | + url=URL, |
28 | 92 | license='MIT', |
29 | | - packages=find_packages(), |
30 | | - install_requires=[ |
31 | | - 'numpy', 'numpy-stl', 'enum34', 'scipy', 'matplotlib', 'vtk', |
32 | | - 'Sphinx==1.4', 'sphinx_rtd_theme' |
33 | | - ], |
| 93 | + packages=[NAME], |
| 94 | + install_requires=REQUIRED, |
| 95 | + extras_require=EXTRAS, |
34 | 96 | test_suite='nose.collector', |
35 | 97 | tests_require=['nose'], |
36 | 98 | include_package_data=True, |
37 | | - zip_safe=False) |
| 99 | + zip_safe=False, |
| 100 | + |
| 101 | + # $ setup.py publish support. |
| 102 | + cmdclass={ |
| 103 | + 'upload': UploadCommand, |
| 104 | + },) |
0 commit comments