diff options
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 129 |
1 files changed, 72 insertions, 57 deletions
@@ -1,68 +1,83 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 -# Copyright 2013-2014 Paulo Henrique Silva <ph.silva@gmail.com> +from os import environ +from os.path import join, abspath, dirname +from codecs import open +from setuptools import setup, find_packages +from subprocess import check_output -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# http://www.apache.org/licenses/LICENSE-2.0 +def long_description(): + with open('README.md', 'r') as fh: + return fh.read() -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -import os +def version(): + with open(join(abspath(dirname(__file__)), 'gerbonara/__init__.py')) as fh: + for line in fh: + if line.startswith('__version__'): + ver = line.split("'")[1] + if environ.get('CI_COMMIT_SHA', '') != '' and environ.get('CI_COMMIT_TAG', '') == '': + # attach commit hash to non tagged test uploads from CI + commits = check_output(['/usr/bin/env', 'git', 'rev-list', '--count', 'HEAD'], text=True) + return f'{ ver }.dev{ commits.strip() }' + return ver -def read(fname): - return open(os.path.join(os.path.dirname(__file__), fname)).read() + raise RuntimeError('Unable to find version string.') -METADATA = { - 'name': 'pcb-tools', - 'version': 0.1, - 'author': 'Paulo Henrique Silva <ph.silva@gmail.com>, Hamilton Kibbe <ham@hamiltonkib.be>', - 'author_email': "ph.silva@gmail.com, ham@hamiltonkib.be", - 'description': "Utilities to handle Gerber (RS-274X) files.", - 'license': "Apache", - 'keywords': "pcb gerber tools", - 'url': "http://github.com/curtacircuitos/pcb-tools", - 'packages': ['gerber', 'gerber.render'], - 'long_description': read('README.md'), - 'classifiers': [ - "Development Status :: 3 - Alpha", - "Topic :: Utilities", - "License :: OSI Approved :: Apache Software License", - ], -} - -SETUPTOOLS_METADATA = { - 'install_requires': ['cairocffi==0.6'], - 'entry_points': { +setup( + name='gerbonara', + version=version(), + author='XenGi, Jaseg', + author_email='contact@gerbonara.io', + description='Tools to handle Gerber and Excellon files in Python', + long_description=long_description(), + long_description_content_type='text/markdown', + url='https://gitlab.com/gerbonara/gerbonara', + project_urls={ + # 'Documentation': 'https://packaging.python.org/tutorials/distributing-packages/', + # 'Funding': 'https://donate.pypi.org', + # 'Say Thanks!': 'http://saythanks.io/to/example', + 'Source': 'https://gitlab.com/gerbonara/gerbonara', + 'Tracker': 'https://gitlab.com/gerbonara/gerbonara/issues', + }, + packages=find_packages(exclude=['tests']), + install_requires=['click'], + entry_points={ 'console_scripts': [ - 'gerber-render = gerber.__main__:main', + 'gerbonara = gerbonara.cli:cli', ], }, -} - - -def install(): - """ Install using setuptools, fallback to distutils - """ - try: - from setuptools import setup - METADATA.update(SETUPTOOLS_METADATA) - setup(**METADATA) - except ImportError: - from sys import stderr - stderr.write('Could not import setuptools, using distutils') - stderr.write('NOTE: You will need to install dependencies manually') - from distutils.core import setup - setup(**METADATA) - - -if __name__ == '__main__': - install() + classifiers=[ + 'Development Status :: 1 - Planning', + #'Development Status :: 3 - Alpha', + #'Development Status :: 4 - Beta', + #'Development Status :: 5 - Production/Stable', + 'Environment :: Console', + 'Intended Audience :: Developers', + 'Intended Audience :: Information Technology', + 'Intended Audience :: Manufacturing', + 'Intended Audience :: Science/Research', + 'License :: OSI Approved :: Apache Software License', + 'Natural Language :: English', + 'Operating System :: POSIX :: Linux', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3 :: Only', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', + 'Topic :: Artistic Software', + 'Topic :: Multimedia :: Graphics', + 'Topic :: Printing', + 'Topic :: Scientific/Engineering', + 'Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)', + 'Topic :: Scientific/Engineering :: Image Processing', + 'Topic :: Utilities', + 'Typing :: Typed', + ], + keywords='gerber excellon pcb', + python_requires='>=3.6', +) |