← Back to team overview

divmod-dev team mailing list archive

[Merge] lp:~nejucomo/divmod.org/fix-nevow-setup into lp:divmod.org

 

nejucomo has proposed merging lp:~nejucomo/divmod.org/fix-nevow-setup into lp:divmod.org.

Requested reviews:
  Michael Hudson-Doyle (mwhudson)

For more details, see:
https://code.launchpad.net/~nejucomo/divmod.org/fix-nevow-setup/+merge/176026

This is a bzr branch which should fix the packaging issue which prevents Nevow from being installable in an environment without twisted pre-installed.

Caveats:

* I'm new to bzr, so please double check the bzr revision/merge structure.
* I hope this merge request represents the same change as applying the patch in https://bugs.launchpad.net/nevow/+bug/1091055/comments/5
* I only tested this by running "pip install ." in a new virtualenv (without twisted).
* It uses a regex which will be brittle to changes in nevow/_version.py.
* It uses a regex, so now there's N+1 problems.  ;-)
-- 
https://code.launchpad.net/~nejucomo/divmod.org/fix-nevow-setup/+merge/176026
Your team Divmod-dev is subscribed to branch lp:divmod.org.
=== modified file 'Nevow/setup.py'
--- Nevow/setup.py	2009-11-30 01:08:55 +0000
+++ Nevow/setup.py	2013-07-20 20:55:32 +0000
@@ -1,13 +1,20 @@
 #!/usr/bin/python
 
-from nevow import __version__ as version
+import os
+import re
+
+# Parse the version without importing nevow or twisted:
+with file(os.path.join('nevow', '_version.py'), 'r') as f:
+    match = re.search(r'^version = versions.Version\(.*?, (\d+), (\d+), (\d+)\)$', f.read(), re.MULTILINE)
+    version = '%s.%s.%s' % (match.group(1), match.group(2), match.group(3))
+
+del f, match # Cleanup temporaries used to parse version.
 
 try:
     import setuptools
 except ImportError:
     setuptools = None
 
-import os
 data_files=[]
 for (dirpath, dirnames, filenames) in os.walk("doc"):
     if ".svn" in dirnames:


Follow ups