aboutsummaryrefslogtreecommitdiffstats
path: root/setup.py
diff options
context:
space:
mode:
authorWaylan Limberg <waylan.limberg@icloud.com>2017-12-08 19:48:08 -0500
committerWaylan Limberg <waylan.limberg@icloud.com>2017-12-08 20:46:24 -0500
commit52b8da8e47c6dce643504f503c995c310b14bd19 (patch)
tree33ed7b1225fa2413bdc39fd55ac5cbc039bc87ff /setup.py
parent78c7b25454dc949f0a9037097f1f685bb6fe615b (diff)
downloadmarkdown-52b8da8e47c6dce643504f503c995c310b14bd19.tar.gz
markdown-52b8da8e47c6dce643504f503c995c310b14bd19.tar.bz2
markdown-52b8da8e47c6dce643504f503c995c310b14bd19.zip
Switch to setuptools.
Use console_scripts entry_point instead of manually built script.
Diffstat (limited to 'setup.py')
-rwxr-xr-xsetup.py70
1 files changed, 19 insertions, 51 deletions
diff --git a/setup.py b/setup.py
index fba5172..a356d8d 100755
--- a/setup.py
+++ b/setup.py
@@ -1,10 +1,7 @@
#!/usr/bin/env python
-from __future__ import with_statement
-import sys
+from setuptools import setup
import os
-from distutils.core import setup
-from distutils.command.install_scripts import install_scripts
import imp
@@ -14,54 +11,23 @@ def get_version():
fp, pathname, desc = imp.find_module('__version__', [path])
try:
v = imp.load_module('__version__', fp, pathname, desc)
- return v.version, v.version_info
finally:
fp.close()
+ dev_status_map = {
+ 'alpha': '3 - Alpha',
+ 'beta': '4 - Beta',
+ 'rc': '4 - Beta',
+ 'final': '5 - Production/Stable'
+ }
+ if v.version_info[3] == 'alpha' and v.version_info[4] == 0:
+ status = '2 - Pre-Alpha'
+ else:
+ status = dev_status_map[v.version_info[3]]
+ return v.version, v.version_info, status
-version, version_info = get_version()
-# Get development Status for classifiers
-dev_status_map = {
- 'alpha': '3 - Alpha',
- 'beta': '4 - Beta',
- 'rc': '4 - Beta',
- 'final': '5 - Production/Stable'
-}
-if version_info[3] == 'alpha' and version_info[4] == 0:
- DEVSTATUS = '2 - Pre-Alpha'
-else:
- DEVSTATUS = dev_status_map[version_info[3]]
-
-# The command line script name. Currently set to "markdown_py" so as not to
-# conflict with the perl implimentation (which uses "markdown"). We can't use
-# "markdown.py" as the default config on some systems will cause the script to
-# try to import itself rather than the library which will raise an error.
-SCRIPT_NAME = 'markdown_py'
-
-
-class md_install_scripts(install_scripts):
-
- """ Customized install_scripts. Create markdown_py.bat for win32. """
-
- def run(self):
- install_scripts.run(self)
-
- if sys.platform == 'win32':
- try:
- script_dir = os.path.join(sys.prefix, 'Scripts')
- script_path = os.path.join(script_dir, SCRIPT_NAME)
- bat_str = '@"%s" "%s" %%*' % (sys.executable, script_path)
- bat_path = os.path.join(
- self.install_dir, '%s.bat' % SCRIPT_NAME
- )
- f = open(bat_path, 'w')
- f.write(bat_str)
- f.close()
- print('Created: %s' % bat_path)
- except Exception:
- _, err, _ = sys.exc_info() # for both 2.x & 3.x compatability
- print('ERROR: Unable to create %s: %s' % (bat_path, err))
+version, version_info, DEVSTATUS = get_version()
long_description = '''
@@ -72,7 +38,7 @@ on what exactly is supported and what is not. Additional features are
supported by the `Available Extensions`_.
.. _Markdown: http://daringfireball.net/projects/markdown/
-.. _Features: https://Python-Markdown.github.io#Features
+.. _Features: https://Python-Markdown.github.io#features
.. _`Available Extensions`: https://Python-Markdown.github.io/extensions/
Support
@@ -85,6 +51,7 @@ You may ask for help and discuss various other issues on the
.. _`bug tracker`: http://github.com/Python-Markdown/markdown/issues
'''
+
setup(
name='Markdown',
version=version,
@@ -98,9 +65,10 @@ setup(
maintainer_email='waylan.limberg@icloud.com',
license='BSD License',
packages=['markdown', 'markdown.extensions'],
- scripts=['bin/%s' % SCRIPT_NAME],
- cmdclass={
- 'install_scripts': md_install_scripts
+ entry_points={
+ 'console_scripts': [
+ 'markdown = markdown.__main__:run',
+ ]
},
classifiers=[
'Development Status :: %s' % DEVSTATUS,