summaryrefslogtreecommitdiff
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
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.
-rw-r--r--README.txt26
-rw-r--r--setup.py21
2 files changed, 29 insertions, 18 deletions
diff --git a/README.txt b/README.txt
index f4235a3..87b0b6c 100644
--- a/README.txt
+++ b/README.txt
@@ -2,28 +2,30 @@ argparse 1.0
============
The argparse module provides an easy, declarative interface for
creating command line tools, which knows how to:
- * parse the arguments and flags from sys.argv
- * convert arg strings into objects for your program
- * format and print informative help messages
- * and much more...
+
+* parse the arguments and flags from sys.argv
+* convert arg strings into objects for your program
+* format and print informative help messages
+* and much more...
The argparse module improves on the standard library optparse module
in a number of ways including:
- * handling positional arguments
- * supporting sub-commands
- * allowing alternative option prefixes like + and /
- * handling zero-or-more and one-or-more style arguments
- * producing more informative usage messages
- * providing a much simpler interface for custom types and actions
-REQUIREMENTS & INSTALLATION
+* handling positional arguments
+* supporting sub-commands
+* allowing alternative option prefixes like + and /
+* handling zero-or-more and one-or-more style arguments
+* producing more informative usage messages
+* providing a much simpler interface for custom types and actions
+
+Requirements & Installation
---------------------------
The argparse module requires Python 2.3 or greater, and can be
installed with the standard Python installation procedure:
python setup.py install
-AVAILABILITY & DOCUMENTATION
+Availability & Documentation
----------------------------
The latest version of argparse, along with API documentation and
examples can be found at:
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',