1
1
#!/usr/bin/env python
2
2
3
- from __future__ import with_statement
4
- import sys
3
+ from setuptools import setup
5
4
import os
6
- from distutils .core import setup
7
- from distutils .command .install_scripts import install_scripts
8
5
import imp
9
6
10
7
@@ -14,54 +11,23 @@ def get_version():
14
11
fp , pathname , desc = imp .find_module ('__version__' , [path ])
15
12
try :
16
13
v = imp .load_module ('__version__' , fp , pathname , desc )
17
- return v .version , v .version_info
18
14
finally :
19
15
fp .close ()
20
16
17
+ dev_status_map = {
18
+ 'alpha' : '3 - Alpha' ,
19
+ 'beta' : '4 - Beta' ,
20
+ 'rc' : '4 - Beta' ,
21
+ 'final' : '5 - Production/Stable'
22
+ }
23
+ if v .version_info [3 ] == 'alpha' and v .version_info [4 ] == 0 :
24
+ status = '2 - Pre-Alpha'
25
+ else :
26
+ status = dev_status_map [v .version_info [3 ]]
27
+ return v .version , v .version_info , status
21
28
22
- version , version_info = get_version ()
23
29
24
- # Get development Status for classifiers
25
- dev_status_map = {
26
- 'alpha' : '3 - Alpha' ,
27
- 'beta' : '4 - Beta' ,
28
- 'rc' : '4 - Beta' ,
29
- 'final' : '5 - Production/Stable'
30
- }
31
- if version_info [3 ] == 'alpha' and version_info [4 ] == 0 :
32
- DEVSTATUS = '2 - Pre-Alpha'
33
- else :
34
- DEVSTATUS = dev_status_map [version_info [3 ]]
35
-
36
- # The command line script name. Currently set to "markdown_py" so as not to
37
- # conflict with the perl implimentation (which uses "markdown"). We can't use
38
- # "markdown.py" as the default config on some systems will cause the script to
39
- # try to import itself rather than the library which will raise an error.
40
- SCRIPT_NAME = 'markdown_py'
41
-
42
-
43
- class md_install_scripts (install_scripts ):
44
-
45
- """ Customized install_scripts. Create markdown_py.bat for win32. """
46
-
47
- def run (self ):
48
- install_scripts .run (self )
49
-
50
- if sys .platform == 'win32' :
51
- try :
52
- script_dir = os .path .join (sys .prefix , 'Scripts' )
53
- script_path = os .path .join (script_dir , SCRIPT_NAME )
54
- bat_str = '@"%s" "%s" %%*' % (sys .executable , script_path )
55
- bat_path = os .path .join (
56
- self .install_dir , '%s.bat' % SCRIPT_NAME
57
- )
58
- f = open (bat_path , 'w' )
59
- f .write (bat_str )
60
- f .close ()
61
- print ('Created: %s' % bat_path )
62
- except Exception :
63
- _ , err , _ = sys .exc_info () # for both 2.x & 3.x compatability
64
- print ('ERROR: Unable to create %s: %s' % (bat_path , err ))
30
+ version , version_info , DEVSTATUS = get_version ()
65
31
66
32
67
33
long_description = '''
@@ -72,7 +38,7 @@ def run(self):
72
38
supported by the `Available Extensions`_.
73
39
74
40
.. _Markdown: http://daringfireball.net/projects/markdown/
75
- .. _Features: https://Python-Markdown.github.io#Features
41
+ .. _Features: https://Python-Markdown.github.io#features
76
42
.. _`Available Extensions`: https://Python-Markdown.github.io/extensions/
77
43
78
44
Support
@@ -85,6 +51,7 @@ def run(self):
85
51
.. _`bug tracker`: http://github.com/Python-Markdown/markdown/issues
86
52
'''
87
53
54
+
88
55
setup (
89
56
name = 'Markdown' ,
90
57
version = version ,
@@ -98,9 +65,10 @@ def run(self):
98
65
maintainer_email = '[email protected] ' ,
99
66
license = 'BSD License' ,
100
67
packages = ['markdown' , 'markdown.extensions' ],
101
- scripts = ['bin/%s' % SCRIPT_NAME ],
102
- cmdclass = {
103
- 'install_scripts' : md_install_scripts
68
+ entry_points = {
69
+ 'console_scripts' : [
70
+ 'markdown = markdown.__main__:run' ,
71
+ ]
104
72
},
105
73
classifiers = [
106
74
'Development Status :: %s' % DEVSTATUS ,
0 commit comments