diff options
Diffstat (limited to 'setup.py')
-rwxr-xr-x | setup.py | 127 |
1 files changed, 72 insertions, 55 deletions
@@ -1,7 +1,8 @@ #!/usr/bin/env python from __future__ import with_statement -import sys, os +import sys +import os from distutils.core import setup from distutils.command.install_scripts import install_scripts from distutils.command.build import build @@ -10,6 +11,7 @@ from distutils.util import change_root, newer import codecs import imp + def get_version(): " Get version & version_info without importing markdown.__init__ " path = os.path.join(os.path.dirname(__file__), 'markdown') @@ -25,8 +27,8 @@ version, version_info = get_version() # Get development Status for classifiers dev_status_map = { 'alpha': '3 - Alpha', - 'beta' : '4 - Beta', - 'rc' : '4 - Beta', + 'beta': '4 - Beta', + 'rc': '4 - Beta', 'final': '5 - Production/Stable' } if version_info[3] == 'alpha' and version_info[4] == 0: @@ -40,6 +42,7 @@ else: # 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): @@ -50,13 +53,15 @@ class md_install_scripts(install_scripts): 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) + 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 + _, err, _ = sys.exc_info() # for both 2.x & 3.x compatability print ('ERROR: Unable to create %s: %s' % (bat_path, err)) @@ -79,9 +84,11 @@ class build_docs(Command): self.sitemap = '' def finalize_options(self): - self.set_undefined_options('build', - ('build_base', 'build_base'), - ('force', 'force')) + self.set_undefined_options( + 'build', + ('build_base', 'build_base'), + ('force', 'force') + ) self.docs = self._get_docs() def _get_docs(self): @@ -95,13 +102,13 @@ class build_docs(Command): """ Build and return context to pass to template. """ # set defaults c = { - 'title' : '', - 'prev_url' : '', - 'prev_title' : '', - 'next_url' : '', - 'next_title' : '', - 'crumb' : '', - 'version' : version, + 'title': '', + 'prev_url': '', + 'prev_title': '', + 'next_url': '', + 'next_title': '', + 'crumb': '', + 'version': version, } c['body'] = self.md.convert(src) c['toc'] = self.md.toc @@ -145,7 +152,14 @@ class build_docs(Command): with codecs.open('docs/_template.html', encoding='utf-8') as f: template = f.read() self.md = markdown.Markdown( - extensions=['extra', 'toc(permalink=true)', 'meta', 'admonition', 'smarty']) + extensions=[ + 'extra', + 'toc(permalink=true)', + 'meta', + 'admonition', + 'smarty' + ] + ) for infile in self.docs: outfile, ext = os.path.splitext(infile) if ext == '.txt': @@ -192,11 +206,11 @@ class md_build(build): sub_commands = build.sub_commands + [('build_docs', has_docs)] -long_description = \ -'''This is a Python implementation of John Gruber's Markdown_. +long_description = ''' +This is a Python implementation of John Gruber's Markdown_. It is almost completely compliant with the reference implementation, -though there are a few known issues. See Features_ for information -on what exactly is supported and what is not. Additional features are +though there are a few known issues. See Features_ for information +on what exactly is supported and what is not. Additional features are supported by the `Available Extensions`_. .. _Markdown: http://daringfireball.net/projects/markdown/ @@ -214,38 +228,41 @@ You may ask for help and discuss various other issues on the ''' setup( - name = 'Markdown', - version = version, - url = 'https://pythonhosted.org/Markdown/', - download_url = 'http://pypi.python.org/packages/source/M/Markdown/Markdown-%s.tar.gz' % version, - description = 'Python implementation of Markdown.', - long_description = long_description, - author = 'Manfred Stienstra, Yuri takhteyev and Waylan limberg', - author_email = 'markdown [at] freewisdom.org', - maintainer = 'Waylan Limberg', - maintainer_email = 'waylan [at] gmail.com', - license = 'BSD License', - packages = ['markdown', 'markdown.extensions'], - scripts = ['bin/%s' % SCRIPT_NAME], - cmdclass = {'install_scripts': md_install_scripts, - 'build_docs': build_docs, - 'build': md_build}, - classifiers = ['Development Status :: %s' % DEVSTATUS, - 'License :: OSI Approved :: BSD License', - 'Operating System :: OS Independent', - 'Programming Language :: Python', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.2', - 'Programming Language :: Python :: 3.3', - 'Programming Language :: Python :: 3.4', - 'Topic :: Communications :: Email :: Filters', - 'Topic :: Internet :: WWW/HTTP :: Dynamic Content :: CGI Tools/Libraries', - 'Topic :: Internet :: WWW/HTTP :: Site Management', - 'Topic :: Software Development :: Documentation', - 'Topic :: Software Development :: Libraries :: Python Modules', - 'Topic :: Text Processing :: Filters', - 'Topic :: Text Processing :: Markup :: HTML', - ], - ) + name='Markdown', + version=version, + url='https://pythonhosted.org/Markdown/', + download_url='http://pypi.python.org/packages/source/M/Markdown/Markdown-%s.tar.gz' % version, + description='Python implementation of Markdown.', + long_description=long_description, + author='Manfred Stienstra, Yuri takhteyev and Waylan limberg', + author_email='markdown [at] freewisdom.org', + maintainer='Waylan Limberg', + maintainer_email='waylan [at] gmail.com', + license='BSD License', + packages=['markdown', 'markdown.extensions'], + scripts=['bin/%s' % SCRIPT_NAME], + cmdclass={ + 'install_scripts': md_install_scripts, + 'build_docs': build_docs, + 'build': md_build + }, + classifiers=[ + 'Development Status :: %s' % DEVSTATUS, + 'License :: OSI Approved :: BSD License', + 'Operating System :: OS Independent', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.2', + 'Programming Language :: Python :: 3.3', + 'Programming Language :: Python :: 3.4', + 'Topic :: Communications :: Email :: Filters', + 'Topic :: Internet :: WWW/HTTP :: Dynamic Content :: CGI Tools/Libraries', + 'Topic :: Internet :: WWW/HTTP :: Site Management', + 'Topic :: Software Development :: Documentation', + 'Topic :: Software Development :: Libraries :: Python Modules', + 'Topic :: Text Processing :: Filters', + 'Topic :: Text Processing :: Markup :: HTML' + ] +) |