new file: makefile
[GalaxyCodeBases.git] / python / markdowngfm / setup.py
blobe164863a080fb555ed77a868e0923045d6a5048f
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
4 # Note: To use the 'upload' functionality of this file, you must:
5 # $ pipenv install twine --dev
7 import io
8 import os
9 import sys
10 from shutil import rmtree
11 from setuptools import find_packages, setup, Command
13 # Package meta-data.
14 NAME = 'markdowngfm'
15 DESCRIPTION = 'My short description for my project.'
16 URL = ''
17 EMAIL = ''
18 AUTHOR = 'Galaxy'
19 REQUIRES_PYTHON = '>=3.6.0'
20 VERSION = '0.1.0'
22 # What packages are required for this module to be executed?
23 REQUIRED = [
24 'Click',
25 'cmarkgfm',
26 'weasyprint',
27 'wheel', # For .exe generation under Windows
30 # What packages are optional?
31 EXTRAS = {
32 # 'fancy feature': ['django'],
33 ':sys_platform=="win32"': ['colorama'],
34 ':sys_platform=="cygwin"': ['colorama'],
37 # The rest you shouldn't have to touch too much :)
38 # ------------------------------------------------
39 # Except, perhaps the License and Trove Classifiers!
40 # If you do change the License, remember to change the Trove Classifier for that!
42 here = os.path.abspath(os.path.dirname(__file__))
44 # Import the README and use it as the long-description.
45 # Note: this will only work if 'README.md' is present in your MANIFEST.in file!
46 try:
47 with io.open(os.path.join(here, 'README.md'), encoding='utf-8') as f:
48 long_description = '\n' + f.read()
49 except FileNotFoundError:
50 long_description = DESCRIPTION
52 # Load the package's __version__.py module as a dictionary.
53 about = {}
54 if not VERSION:
55 project_slug = NAME.lower().replace("-", "_").replace(" ", "_")
56 with open(os.path.join(here, project_slug, '__version__.py')) as f:
57 exec(f.read(), about)
58 else:
59 about['__version__'] = VERSION
62 class UploadCommand(Command):
63 """Support setup.py upload."""
65 description = 'Build and publish the package.'
66 user_options = []
68 @staticmethod
69 def status(s):
70 """Prints things in bold."""
71 print('\033[1m{0}\033[0m'.format(s))
73 def initialize_options(self):
74 pass
76 def finalize_options(self):
77 pass
79 def run(self):
80 try:
81 self.status('Removing previous builds…')
82 rmtree(os.path.join(here, 'dist'))
83 except OSError:
84 pass
86 self.status('Building Source and Wheel (universal) distribution…')
87 os.system('{0} setup.py sdist bdist_wheel --universal'.format(sys.executable))
89 self.status('Uploading the package to PyPI via Twine…')
90 os.system('twine upload dist/*')
92 self.status('Pushing git tags…')
93 os.system('git tag v{0}'.format(about['__version__']))
94 os.system('git push --tags')
96 sys.exit()
99 # Where the magic happens:
100 setup(
101 name=NAME,
102 version=about['__version__'],
103 description=DESCRIPTION,
104 long_description=long_description,
105 long_description_content_type='text/markdown',
106 author=AUTHOR,
107 author_email=EMAIL,
108 python_requires=REQUIRES_PYTHON,
109 url=URL,
110 packages=find_packages('src'),
111 package_dir={'': 'src'},
112 entry_points={
113 'console_scripts': ['mdgfm=markdowngfm.shell:main'],
114 }, # With console_scripts ActivePython can generate .exe file under Windows
116 install_requires=REQUIRED,
117 extras_require=EXTRAS,
118 include_package_data=True,
119 package_data={
120 '': ['htm/*.htm'],
122 #exclude_package_data={"": ["README.txt"]},
124 license='MIT',
125 classifiers=[
126 # Trove classifiers
127 # Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers
128 'License :: OSI Approved :: MIT License',
129 'Programming Language :: Python',
130 'Programming Language :: Python :: 3',
131 'Programming Language :: Python :: 3.6',
132 "Programming Language :: Python :: 3.7",
133 'Programming Language :: Python :: Implementation :: CPython',
134 'Programming Language :: Python :: Implementation :: PyPy'
136 # $ setup.py publish support.
137 cmdclass={
138 'upload': UploadCommand,