Victor Stinner avatar Victor Stinner committed 82519e1

setup.py reads README instead of using README.py

Comments (0)

Files changed (3)

hachoir-parser/ChangeLog

 hachoir-parser 1.3.2
 ====================
 
-XXX
+ * Include the README file in the tarball
+ * setup.py reads the README file instead of using README.py to break the
+   build dependency on hachoir-core
 
 hachoir-parser 1.3.1 (2010-01-28)
 =================================

hachoir-parser/README.py

 #!/usr/bin/env python
+from __future__ import with_statement
 
 def writeReadme(out):
     from hachoir_parser.parser_list import HachoirParserList
     HachoirParserList().print_(out=out, format=format)
 
 def main():
-    readme = open('README', 'w')
-    writeReadme(readme)
-    readme.close()
+    with open('README', 'w') as readme:
+        writeReadme(readme)
     print "README updated."
 
 if __name__ == "__main__":

hachoir-parser/setup.py

 #!/usr/bin/env python
+from __future__ import with_statement
 from imp import load_source
 from os import path
 from sys import argv
 #  - run: hg commit
 #  - run: hg tag hachoir-parser-XXX
 #  - run: hg push
+#  - run: ./README.py
 #  - run: python2.5 ./setup.py --setuptools register sdist bdist_egg upload
 #  - run: python2.4 ./setup.py --setuptools bdist_egg upload
 #  - run: python2.6 ./setup.py --setuptools bdist_egg upload
+#  - run: rm README
 #  - check http://pypi.python.org/pypi/hachoir-parser
 #  - update the website
 #    * http://bitbucket.org/haypo/hachoir/wiki/Install/source
     "archive", "audio", "container", "common", "file_system", "game",
     "image", "misc", "network", "program", "video")
 
-def getLongDescription():
-    from README import writeReadme
-    from StringIO import StringIO
-    out = StringIO()
-    writeReadme(out)
-    out.seek(0)
-    return out.read()
-
 def main():
     if "--setuptools" in argv:
         argv.remove("--setuptools")
     for name in MODULES:
         PACKAGES["hachoir_parser." + name] = "hachoir_parser/" + name
 
+    with open('README') as readme:
+        long_description = readme.read()
+
     install_options = {
         "name": hachoir_parser.PACKAGE,
         "version": hachoir_parser.__version__,
         "download_url": hachoir_parser.WEBSITE,
         "author": "Hachoir team (see AUTHORS file)",
         "description": "Package of Hachoir parsers used to open binary files",
-        "long_description": getLongDescription(),
+        "long_description": long_description,
         "classifiers": CLASSIFIERS,
         "license": hachoir_parser.LICENSE,
         "packages": PACKAGES.keys(),
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.