Ticket #1190: requires.patch.txt

File requires.patch.txt, 5.3 KB (added by zooko, at 2010-10-15T06:58:50Z)
Line 
1--- old-trunk/setup.py  2010-10-15 00:30:26.000000000 -0600
2+++ new-trunk/setup.py  2010-10-15 00:30:27.000000000 -0600
3@@ -38,6 +38,20 @@
4 
5 version = read_version_py("src/allmydata/_version.py")
6 
7+# setuptools/zetuptoolz looks in __main__.__requires__ for a list of
8+# requirements. When running "python setup.py test", __main__ is
9+# setup.py, so we put the list here so that the requirements will be
10+# available for tests:
11+
12+# Tahoe's dependencies are managed by the find_links= entry in setup.cfg and
13+# the _auto_deps.install_requires list, which is used in the call to setup()
14+# below.
15+adglobals = {}
16+execfile('src/allmydata/_auto_deps.py', adglobals)
17+install_requires = adglobals['install_requires']
18+
19+__requires__ = install_requires
20+
21 egg = os.path.realpath(glob.glob('setuptools-*.egg')[0])
22 sys.path.insert(0, egg)
23 egg = os.path.realpath(glob.glob('darcsver-*.egg')[0])
24@@ -319,13 +333,6 @@
25 
26         return sdist.sdist.make_distribution(self)
27 
28-# Tahoe's dependencies are managed by the find_links= entry in setup.cfg and
29-# the _auto_deps.install_requires list, which is used in the call to setup()
30-# below.
31-adglobals = {}
32-execfile('src/allmydata/_auto_deps.py', adglobals)
33-install_requires = adglobals['install_requires']
34-
35 APPNAME='allmydata-tahoe'
36 APPNAMEFILE = os.path.join('src', 'allmydata', '_appname.py')
37 APPNAMEFILESTR = "__appname__ = '%s'" % (APPNAME,)
38--- old-trunk/setuptools-0.6c16dev2.egg/setuptools/command/easy_install.py      2010-10-15 00:30:26.000000000 -0600
39+++ new-trunk/setuptools-0.6c16dev2.egg/setuptools/command/easy_install.py      2010-10-15 00:30:27.000000000 -0600
40@@ -584,10 +584,11 @@
41         spec = str(dist.as_requirement())
42         is_script = is_python_script(script_text, script_name)
43 
44+        requires = [str(r) for r in dist.requires()]
45         if is_script and dev_path:
46             script_text = get_script_header(script_text) + (
47                 "# EASY-INSTALL-DEV-SCRIPT: %(spec)r,%(script_name)r\n"
48-                "__requires__ = %(spec)r\n"
49+                "__requires__ = %(requires)r\n"
50                 "from pkg_resources import require; require(%(spec)r)\n"
51                 "del require\n"
52                 "__file__ = %(dev_path)r\n"
53@@ -596,7 +597,7 @@
54         elif is_script:
55             script_text = get_script_header(script_text) + (
56                 "# EASY-INSTALL-SCRIPT: %(spec)r,%(script_name)r\n"
57-                "__requires__ = %(spec)r\n"
58+                "__requires__ = %(requires)r\n"
59                 "import pkg_resources\n"
60                 "pkg_resources.run_script(%(spec)r, %(script_name)r)\n"
61             ) % locals()
62@@ -1575,6 +1576,7 @@
63 def get_script_args(dist, executable=sys_executable, wininst=False, script_dir=None):
64     """Yield write_script() argument tuples for a distribution's entrypoints"""
65     spec = str(dist.as_requirement())
66+    requires = [str(r) for r in dist.requires()]
67     header = get_script_header("", executable, wininst)
68     generated_by = "# generated by zetuptoolz %s" % (setuptools_version,)
69 
70@@ -1583,7 +1585,7 @@
71             script_head, script_tail = ((
72                 "# EASY-INSTALL-ENTRY-SCRIPT: %(spec)r,%(group)r,%(name)r\n"
73                 "%(generated_by)s\n"
74-                "__requires__ = %(spec)r\n"
75+                "__requires__ = %(requires)r\n"
76                 "import sys\n"
77                 "from pkg_resources import load_entry_point\n"
78                 "\n"
79diff -rN -u old-trunk/src/allmydata/scripts/create_node.py new-trunk/src/allmydata/scripts/create_node.py
80--- old-trunk/src/allmydata/scripts/create_node.py      2010-10-15 00:30:26.000000000 -0600
81+++ new-trunk/src/allmydata/scripts/create_node.py      2010-10-15 00:30:28.000000000 -0600
82@@ -28,11 +28,13 @@
83         ["node-directory", "d", None, "Specify which directory the introducer should be created in. [no default]"],
84     ]
85 
86-client_tac = """
87+client_tac_templ = """
88 # -*- python -*-
89 
90+__requires__ = %(requires)r
91+
92 import pkg_resources
93-pkg_resources.require('%s')
94+pkg_resources.require('%(appname)s')
95 pkg_resources.require('twisted')
96 from allmydata import client
97 from twisted.application import service
98@@ -41,7 +43,10 @@
99 
100 application = service.Application("allmydata_client")
101 c.setServiceParent(application)
102-""" % (allmydata.__appname__,)
103+"""
104+from __main__ import __requires__
105+
106+client_tac = client_tac_templ % { 'requires': __requires__, 'appname': allmydata.__appname__, }
107 
108 introducer_tac = """
109 # -*- python -*-
110diff -rN -u old-trunk/src/allmydata/scripts/keygen.py new-trunk/src/allmydata/scripts/keygen.py
111--- old-trunk/src/allmydata/scripts/keygen.py   2010-10-15 00:30:26.000000000 -0600
112+++ new-trunk/src/allmydata/scripts/keygen.py   2010-10-15 00:30:28.000000000 -0600
113@@ -11,9 +11,11 @@
114         ["node-directory", "d", None, "Specify which directory the key-generator should be created in. [no default]"],
115     ]
116 
117-keygen_tac = """
118+keygen_tac_templ = """
119 # -*- python -*-
120 
121+__requires__ = %(requires)s
122+
123 import pkg_resources
124 pkg_resources.require('allmydata-tahoe')
125 
126@@ -29,6 +31,10 @@
127 k.setServiceParent(application)
128 """
129 
130+from __main__ import __requires__
131+
132+keygen_tac = keygen_tac_templ % { 'requires': __requires__ }
133+
134 def create_key_generator(basedir, config, out=sys.stdout, err=sys.stderr):
135     # This should always be called with an absolute Unicode basedir.
136     precondition(isinstance(basedir, unicode), basedir)