summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorsteven.bethard <devnull@localhost>2009-08-02 15:42:01 +0000
committersteven.bethard <devnull@localhost>2009-08-02 15:42:01 +0000
commitbc5617869939b834107bfcdf1142b879a1903348 (patch)
tree42114afa1d30e536dc61f1abad42c11f68652317 /setup.py
parent891869dfe9cf298950ea1490d846986070b40e2a (diff)
downloadargparse-bc5617869939b834107bfcdf1142b879a1903348.tar.gz
Read description from README.txt file and reformat README.txt so that when it's uploaded to PyPI, it looks right.
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py21
1 files changed, 15 insertions, 6 deletions
diff --git a/setup.py b/setup.py
index 36c1cc0..d69f8a7 100644
--- a/setup.py
+++ b/setup.py
@@ -14,9 +14,21 @@
# License for the specific language governing permissions and limitations
# under the License.
-import textwrap
-import distutils.core
import argparse
+import distutils.core
+import os
+import re
+
+
+def read_description():
+ readme_file = open(os.path.join(os.path.dirname(__file__), 'README.txt'))
+ readme_text = readme_file.read()
+ readme_file.close()
+ main_desc_regexp = r'^argparse\s*[\d.]*\n=======+\n(.*)Requirements &'
+ main_desc, = re.findall(main_desc_regexp, readme_text, re.DOTALL)
+ avail_desc_regexp = r'Availability & Documentation\n-----+\n(.*)'
+ avail_desc, = re.findall(avail_desc_regexp, readme_text, re.DOTALL)
+ return main_desc + avail_desc
distutils.core.setup(
name='argparse',
@@ -25,10 +37,7 @@ distutils.core.setup(
author_email='steven.bethard@gmail.com',
url='http://code.google.com/p/argparse/',
description='Python command-line parsing library',
- long_description = textwrap.dedent("""\
- The argparse module provides an easy, declarative interface for
- creating command line tools.
- """),
+ long_description = read_description(),
license='Apache 2.0',
classifiers=[
'Development Status :: 5 - Production/Stable',