summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py130
1 files changed, 78 insertions, 52 deletions
diff --git a/setup.py b/setup.py
index f621b80..f26885a 100644
--- a/setup.py
+++ b/setup.py
@@ -1,57 +1,83 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-# Copyright 2019 Hiroshi Murayama <opiopan@gmail.com>
-
-import os
-
-def read(fname):
- return open(os.path.join(os.path.dirname(__file__), fname)).read()
-
-METADATA = {
- 'name': 'pcb-tools-extension',
- 'version': "0.9.3",
- 'author': 'Hiroshi Murayama <opiopan@gmail.com>',
- 'author_email': "opiopan@gmail.com",
- 'description': ("Extension for pcb-tools package to panelize gerber files"),
- 'license': "Apache",
- 'keywords': "pcb gerber tools extension",
- 'url': "http://github.com/opiopan/pcb-tools-extension",
- 'packages': ['gerberex'],
- 'long_description': read('README.md'),
- 'long_description_content_type': 'text/markdown',
- 'classifiers': [
- "Development Status :: 4 - Beta",
- "Topic :: Utilities",
- "License :: OSI Approved :: Apache Software License",
+#!/usr/bin/env python3
+
+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
+
+
+def long_description():
+ with open('README.md', 'r') as fh:
+ return fh.read()
+
+
+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
+
+ raise RuntimeError('Unable to find version string.')
+
+
+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': [
+ 'gerbonara = gerbonara.cli:cli',
+ ],
+ },
+ 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.3',
- 'Programming Language :: Python :: 3.4',
- 'Programming Language :: Python :: 3.5',
+ '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',
],
-}
-
-SETUPTOOLS_METADATA = {
- 'install_requires': ['pcb-tools', 'dxfgrabber'],
-}
-
-
-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 manualy')
- from distutils.core import setup
- setup(**METADATA)
-
-if __name__ == '__main__':
- install()
+ keywords='gerber excellon pcb',
+ python_requires='>=3.6',
+)