Commits

Waylan Limberg  committed b2cec4c

Fixed commandline issues and upped version to 2.0.1-beta. Renamed markdown.py to markdown and added a markdown.bat wrapper for win32. Also had to put markdown script in a bin dir so it doesn't clash with the markdown lib dir because win32 doesn't allow a dir and file of the same name in same parent dir.

  • Participants
  • Parent commits ac01847

Comments (0)

Files changed (5)

-include markdown.py
+recursive-include bin *
 recursive-include markdown *.py
 recursive-include docs *
 prune markdown/extensions/legacy.py

File bin/markdown

+#!/usr/bin/env python
+"""
+Python Markdown, the Command Line Script
+========================================
+
+This is the command line script for Python Markdown.
+
+Basic use from the command line:
+
+    python markdown.py source.txt > destination.html
+
+Run "python markdown.py --help" to see more options.
+
+See markdown/__init__.py for information on using Python Markdown as a module.
+
+## Authors and License
+
+Started by [Manfred Stienstra](http://www.dwerg.net/).  Continued and
+maintained  by [Yuri Takhteyev](http://www.freewisdom.org), [Waylan
+Limberg](http://achinghead.com/) and [Artem Yunusov](http://blog.splyer.com).
+
+Contact: markdown@freewisdom.org
+
+Copyright 2007, 2008 The Python Markdown Project (v. 1.7 and later)
+Copyright 200? Django Software Foundation (OrderedDict implementation)
+Copyright 2004, 2005, 2006 Yuri Takhteyev (v. 0.2-1.6b)
+Copyright 2004 Manfred Stienstra (the original version)
+
+License: BSD (see docs/LICENSE for details).
+"""
+
+import logging
+from markdown import COMMAND_LINE_LOGGING_LEVEL
+from markdown import commandline
+
+# Setup a logger manually for compatibility with Python 2.3
+logger = logging.getLogger('MARKDOWN')
+logger.setLevel(COMMAND_LINE_LOGGING_LEVEL)
+logger.addHandler(logging.StreamHandler())
+
+if __name__ == '__main__':
+    commandline.run()

File markdown.py

-#!/usr/bin/env python
-"""
-Python Markdown, the Command Line Script
-========================================
-
-This is the command line script for Python Markdown.
-
-Basic use from the command line:
-
-    python markdown.py source.txt > destination.html
-
-Run "python markdown.py --help" to see more options.
-
-See markdown/__init__.py for information on using Python Markdown as a module.
-
-## Authors and License
-
-Started by [Manfred Stienstra](http://www.dwerg.net/).  Continued and
-maintained  by [Yuri Takhteyev](http://www.freewisdom.org), [Waylan
-Limberg](http://achinghead.com/) and [Artem Yunusov](http://blog.splyer.com).
-
-Contact: markdown@freewisdom.org
-
-Copyright 2007, 2008 The Python Markdown Project (v. 1.7 and later)
-Copyright 200? Django Software Foundation (OrderedDict implementation)
-Copyright 2004, 2005, 2006 Yuri Takhteyev (v. 0.2-1.6b)
-Copyright 2004 Manfred Stienstra (the original version)
-
-License: BSD (see docs/LICENSE for details).
-"""
-
-import sys, os
-if sys.platform == 'win32':
-        # We have to remove the Scripts dir from path on windows.
-        # If we don't, it will try to import itself rather than markdown lib.
-        # This appears to *not* be a problem on *nix systems, only Windows.
-        try:
-            sys.path.remove(os.path.dirname(__file__))
-        except (ValueError, NameError):
-            pass
-
-# Now we can import the markdown lib.
-import logging
-from markdown import COMMAND_LINE_LOGGING_LEVEL
-from markdown import commandline
-
-# Setup a logger manually for compatibility with Python 2.3
-logger = logging.getLogger('MARKDOWN')
-logger.setLevel(COMMAND_LINE_LOGGING_LEVEL)
-logger.addHandler(logging.StreamHandler())
-
-if __name__ == '__main__':
-    commandline.run()

File markdown/__init__.py

 License: BSD (see docs/LICENSE for details).
 """
 
-version = "2.0"
-version_info = (2,0,0, "Final")
+version = "2.0.1-beta"
+version_info = (2,0,1, "beta")
 
 import re
 import codecs
 #!/usr/bin/env python
 
+import sys, os
 from distutils.core import setup
+from distutils.command.install_scripts import install_scripts
 from markdown import version
 
+class md_install_scripts(install_scripts):
+    """ Customized install_scripts. Create markdown.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, 'markdown')
+                bat_str = '@"%s" "%s" %%*' % (sys.executable, script_path)
+                bat_path = os.path.join(self.install_dir, 'markdown.bat')
+                f = file(bat_path, 'w')
+                f.write(bat_str)
+                f.close()
+                print 'Created:', bat_path
+            except Exception, e:
+                print 'ERROR: Unable to create %s: %s' % (bat_path, e)
+
 setup(
     name = 'Markdown',
     version = version,
     maintainer_email = "waylan [at] gmail.com",
     license = "BSD License",
     packages = ['markdown', 'markdown.extensions'],
-    scripts = ['markdown.py'],
+    scripts = ['bin/markdown'],
+    cmdclass = {'install_scripts': md_install_scripts},
     classifiers = ['Development Status :: 5 - Production/Stable',
                    'License :: OSI Approved :: BSD License',
                    'Operating System :: OS Independent',
                    'Programming Language :: Python',
+                   'Programming Language :: Python :: 2',
+                   'Programming Language :: Python :: 2.3',
+                   'Programming Language :: Python :: 2.4',
+                   'Programming Language :: Python :: 2.5',
+                   'Programming Language :: Python :: 2.6',
+                   'Programming Language :: Python :: 3',
+                   'Programming Language :: Python :: 3.0',
                    'Topic :: Communications :: Email :: Filters',
                    'Topic :: Internet :: WWW/HTTP :: Dynamic Content :: CGI Tools/Libraries',
                    'Topic :: Internet :: WWW/HTTP :: Site Management',