Ticket #1246: install-should-only-install-scripts.darcs.patch

File install-should-only-install-scripts.darcs.patch, 19.3 KB (added by davidsarah, at 2010-11-06T00:29:08Z)

setup.py, setup.cfg, bin/tahoe-script.template: make it so that 'python setup.py install' just does a build and installs a script pointing to that build. refs #1246

Line 
11 patch for repository davidsarah@dev.allmydata.org:/home/darcs/tahoe/trunk:
2
3Fri Nov  5 23:57:12 GMT Standard Time 2010  david-sarah@jacaranda.org
4  * setup.py, setup.cfg, bin/tahoe-script.template: make it so that 'python setup.py install' just does a build and installs a script pointing to that build. refs #1246
5
6New patches:
7
8[setup.py, setup.cfg, bin/tahoe-script.template: make it so that 'python setup.py install' just does a build and installs a script pointing to that build. refs #1246
9david-sarah@jacaranda.org**20101105235712
10 Ignore-this: 4f3ef717973a6153e3f94e0f600c2ed4
11] {
12hunk ./bin/tahoe-script.template 2
13 #!/bin/false # You must specify a python interpreter.
14+base = None  # this will be rewritten
15 
16 import errno, sys, os, subprocess
17 
18hunk ./bin/tahoe-script.template 6
19-where = os.path.realpath(sys.argv[0])
20-base = os.path.dirname(os.path.dirname(where))
21+if base is None:
22+    base = os.path.dirname(os.path.dirname(os.path.realpath(sys.argv[0])))
23 
24 if sys.platform == "win32":
25     perhaps_installed_tahoe = os.path.join(os.path.dirname(sys.executable), 'Scripts', 'tahoe.pyscript')
26hunk ./setup.cfg 43
27 build = darcsver --count-all-patches develop --multi-version --prefix=support make_executable build
28 test = darcsver --count-all-patches develop --prefix=support make_executable build trial
29 sdist = darcsver --count-all-patches sdist
30-install = darcsver --count-all-patches install
31+deprecated_install = darcsver --count-all-patches install
32+install = darcsver --count-all-patches develop --prefix=support build make_install
33 bdist_egg = darcsver --count-all-patches bdist_egg
34 trial = darcsver --count-all-patches trial
35 sdist_dsc = darcsver --count-all-patches sdist_dsc
36hunk ./setup.py 261
37         pass
38     def finalize_options(self):
39         pass
40-    def run(self):
41+    def run(self, install=False):
42         bin_tahoe_template = os.path.join("bin", "tahoe-script.template")
43 
44hunk ./setup.py 264
45-        if sys.platform == 'win32':
46-            # 'tahoe' script is needed for cygwin
47-            script_names = ["tahoe.pyscript", "tahoe"]
48-        else:
49-            script_names = ["tahoe"]
50-
51         # Create the tahoe script file under the 'bin' directory. This
52         # file is exactly the same as the 'tahoe-script.template' script
53         # except that the shebang line is rewritten to use our sys.executable
54hunk ./setup.py 271
55         f = open(bin_tahoe_template, "rU")
56         script_lines = f.readlines()
57         f.close()
58-        script_lines[0] = '#!%s\n' % (sys.executable,)
59-        for script_name in script_names:
60-            tahoe_script = os.path.join("bin", script_name)
61+       
62+        def write_script(tahoe_script, base_path=None):
63+            script_lines[0] = '#!%s\n' % (sys.executable,)
64+            script_lines[1] = 'base = %r\n' % (base_path,)
65             try:
66                 os.remove(tahoe_script)
67             except Exception:
68hunk ./setup.py 292
69                                    stat.S_IXOTH | stat.S_IROTH )
70             os.chmod(tahoe_script, new_mode)
71 
72-        old_tahoe_exe = os.path.join("bin", "tahoe.exe")
73-        try:
74-            os.remove(old_tahoe_exe)
75-        except Exception:
76-            if os.path.exists(old_tahoe_exe):
77-                raise
78+        if sys.platform == 'win32':
79+            write_script(os.path.join("bin", "tahoe.pyscript"))
80+
81+            old_tahoe_exe = os.path.join("bin", "tahoe.exe")
82+            try:
83+                os.remove(old_tahoe_exe)
84+            except Exception:
85+                if os.path.exists(old_tahoe_exe):
86+                    raise
87+
88+        # On Windows, 'tahoe' script is still needed for cygwin
89+        write_script(os.path.join("bin", "tahoe"))
90+
91+        if install:
92+            # Globally installed scripts know which Tahoe distribution installed them.
93+            cwd = os.getcwd()
94+            if sys.platform == "win32":
95+                scriptdir = os.path.join(os.path.dirname(sys.executable), "Scripts")
96+                write_script(os.path.join(scriptdir, "tahoe.pyscript"), cwd)
97+            else:
98+                write_script("/usr/bin/tahoe", cwd)
99+
100+
101+class MakeInstall(MakeExecutable):
102+    def run(self):
103+        MakeExecutable.run(self, install=True)
104 
105 
106 class MySdist(sdist.sdist):
107hunk ./setup.py 382
108                 "check_auto_deps": CheckAutoDeps,
109                 "test_mac_diskimage": TestMacDiskImage,
110                 "make_executable": MakeExecutable,
111+                "make_install": MakeInstall,
112                 "sdist": MySdist,
113                 },
114       package_dir = {'':'src'},
115}
116
117Context:
118
119[setup.py: fix a bug in the check for whether we are running 'trial' or 'test', that affected zooko's test for #1233. refs #1233
120david-sarah@jacaranda.org**20101105235415
121 Ignore-this: bc79517853f39301218d7d840de830f2
122]
123[misc/build_helpers/gen-package-table.py: allow all lowercase letters except 'w' (for example, 'c' and 'dev') in package versions.
124david-sarah@jacaranda.org**20101105154756
125 Ignore-this: 1189fad2b0d210e2f827bb710f532f7e
126]
127[setup: fix gen-package-table to allow the "_r$REV" version numbers of packages
128zooko@zooko.com**20101104073944
129 Ignore-this: b6b72b0d2a207929d4ffb0cfc988e8ee
130]
131[misc/build_helpers/run_trial.py: minor refactoring -- make variable names consistent between run_trial.py and test_runner.py
132david-sarah@jacaranda.org**20101104012027
133 Ignore-this: 443fb127ad39015fb2d82bd1beacfa66
134]
135[NEWS: entry for #1242 (tilde expansion in 'tahoe backup --exclude-from'). refs #1242
136david-sarah@jacaranda.org**20101104011915
137 Ignore-this: 1c85e7c74f5a48b4cdae5aa073c6b9fb
138]
139[tests: make test-with-fake-pkg's unacceptably-old fake pycryptopp be 0.5.13 instead of 0.5.17, since 0.5.17 is acceptably new on non-x86 archs
140zooko@zooko.com**20101102053357
141 Ignore-this: a400f6f73c7574f2b2266547b0e7b051
142 Also move the fakepkgs directory to be in misc/build_helpers/ instead of in the base of the source tree.
143]
144[misc/build_helpers/gen-package-table.py: fix missing 'r's (meant to delete CRs :-)
145david-sarah@jacaranda.org**20101103043718
146 Ignore-this: ffa25a18637b6165725a49a79bfa6cc
147]
148[add misc/build_helpers/gen-package-table.py. refs #1247
149david-sarah@jacaranda.org**20101103043328
150 Ignore-this: 3185c869d98d6fecbae4bcc6b74a810d
151]
152[setup: FreeStorm's WinXP-x86-py2.6 buildslave has informed us that there is yet a fourth way to spell "i386" in Python
153zooko@zooko.com**20101101052142
154 Ignore-this: 732892975c19f7fd18caeb071f09ef7
155]
156[setup: add platform.machine() to show-tool-versions, because FreeStorm WinXP builder apparently thinks that its platform.machine() is not one of ['i386', 'x86_64', 'amd64', ''], since it is requiring pycryptopp >= 0.5.14 instead of pycryptopp >= 0.5.20
157zooko@zooko.com**20101101042721
158 Ignore-this: 322a3e5af9785ebca3452f3937ce47a4
159]
160[edit docs for English usage, rename "Tahoe" to "Tahoe-LAFS" in docs/configuration.rst, rename a variable in bin/tahoe-script.template for clarity, update François's CREDITS entry
161zooko@zooko.com**20101101042602
162 Ignore-this: d192c4c9660b1b9173db19d0e533dc22
163]
164[test_runner.py: fix test failure in test_the_right_code after applying zooko's change to test-with-fake-pkg.py
165david-sarah@jacaranda.org**20101102035905
166 Ignore-this: 71b467615ae7dcdfbf84049e60a08933
167]
168[allmydata/__init__.py: move the call to require_auto_deps() to the top again, since the [4784] patch turned out not to be the cause of the failure on the 'mm netbsd5' buildslave.
169david-sarah@jacaranda.org**20101101003316
170 Ignore-this: 879a5188ff2529fb755b6e594c59aeb2
171]
172[allmydata/__init__.py: put the _auto_deps.require_auto_deps() call back in exactly the same place it was prior to [4784].
173david-sarah@jacaranda.org**20101031174649
174 Ignore-this: c5f4fbb2c444d7b05b1d30a199b6178f
175]
176[allmydata/__init__.py: suppress a DeprecationWarning for the sha module on importing pycrypto.
177david-sarah@jacaranda.org**20101031160636
178 Ignore-this: 414d55a0da432cfb0d65329a88e13396
179]
180[misc/build_helpers/run_trial.py: fix another typo in last patch.
181david-sarah@jacaranda.org**20101031160332
182 Ignore-this: 61131c5775a2393b6862f76b7bc222f
183]
184[misc/build_helpers/run_trial.py: fix typo in last patch.
185david-sarah@jacaranda.org**20101031155215
186 Ignore-this: a2fbecf858c0a399e938d4f1ade7329b
187]
188[allmydata/__init__.py: call require_auto_deps() after importing nevow and twisted, reverting change in [4784]. Also fix a missing 'warnings.filters.pop()'.
189david-sarah@jacaranda.org**20101031153828
190 Ignore-this: 8a5cd7798674d56868e9c333a77a4ac2
191]
192[misc/build_helpers/run_trial.py: fix false positive on directory check that can occur when running run_trial from test-with-fake-pkg manually.
193david-sarah@jacaranda.org**20101031153613
194 Ignore-this: 7d4a0758a305cbfdd296570a9c1a88d2
195]
196[allmydata.__init__.py: temporary hack to debug failure on midnightmagic's buildslave
197david-sarah@jacaranda.org**20101031055003
198 Ignore-this: 2ac28b2f19a436a374399b4c59d29cc7
199]
200[NEWS: entries for #1190 and #1212, and minor cleanups. refs #1190, #1212
201david-sarah@jacaranda.org**20101031051426
202 Ignore-this: c318dff69296ae1e1a897752b5221870
203]
204[tahoe backup: perform tilde expansion in exclude-from filename (version 2). fixes #1241
205david-sarah@jacaranda.org**20101031035231
206 Ignore-this: 65e6cd2247dd8d1fc025758d740708c0
207]
208[NEWS: add news entry for #1223
209Francois Deppierraz <francois@ctrlaltdel.ch>**20101030111130
210 Ignore-this: 6b6afd4b0f0527a3c9784c1db95d083
211]
212[NEWS: add a NEWS entry about bug #1045
213Francois Deppierraz <francois@ctrlaltdel.ch>**20101030101351
214 Ignore-this: 7e758afbbd0f1d22a5d0b4fc38661c1d
215]
216[setup: run require_auto_deps() before attempting to import any deps in __init__.py
217zooko@zooko.com**20101030081035
218 Ignore-this: ffcaf2450628543e020e9919e455f691
219 For one thing, this makes missing-dependency failures into DistributionNotFound errors instead of ImportErrors, which might be more useful to the user. For another thing, if someone is using distributions that were installed with --multi-version, then they might be not importable until after require_auto_deps() has been run. (The docs claim that this would be the case, but we don't have an example of this happening at this time.)
220]
221[setup: show-tool-versions: emit module and __version__ information even when module name != distribution (package) name, and add TwistedCore, TwistedWeb, and TwistedConch
222zooko@zooko.com**20101030070233
223 Ignore-this: 3df19910090d44502ddeeef5d9c29a7
224]
225[misc/build_helpers/test-with-fake-pkg.py: look for eggs in the parent of the src directory. refs #1190
226david-sarah@jacaranda.org**20101030034303
227 Ignore-this: 4a3cf286272cdb5d06aac15fb5998b33
228]
229[scripts/runner.py: fix unused import of allmydata. refs #1190
230david-sarah@jacaranda.org**20101030003149
231 Ignore-this: b2fc67f6192ea7ccf8a5ad010ce74a64
232]
233[scripts/runner.py: remove pkg_resources.require() calls. These are at best redundant because we have already called _auto_deps.require_auto_deps() (from allmydata.__init__) at that point, and they are causing failure of the test-from-prefixdir step on some buildslaves. refs #1190
234david-sarah@jacaranda.org**20101029235328
235 Ignore-this: e00dee63acc7b76a5755025d75abf524
236]
237[misc/build_helpers/run_trial.py: look for zetuptoolz egg in the parent directory, not the cwd of run_trial. refs #1190
238david-sarah@jacaranda.org**20101029230329
239 Ignore-this: 1596fb8c290d1c706f079701b1857db8
240]
241[scripts/tahoe_backup.py: oops, fix missing import, thanks pyflakes
242Brian Warner <warner@lothar.com>**20101029094223
243 Ignore-this: 285c35af824935641a5be35c008b080c
244 
245 test_cli.py: hush minor pyflakes complaint
246]
247[mutable/servermap.py: update comment. Closes #1231.
248Brian Warner <warner@lothar.com>**20101029091424
249 Ignore-this: 80bf854123fc254e097a81b82bdf4990
250]
251[tahoe_cp.py: Don't call urllib.quote with an Unicode argument, fix #1224
252Brian Warner <warner@lothar.com>**20101029084520
253 Ignore-this: 5524722d5e5babbb73ca0969d54967f6
254 tahoe_backup.py: Fix another (potential) occurrence of calling urllib.quote()
255 with an Unicode parameter
256]
257[fix #1223, crash+inefficiency during repair due to read overrun
258Brian Warner <warner@lothar.com>**20101029082036
259 Ignore-this: e6aa0295ad254544da3b5cc41b33d862
260 
261 * repairer (really the uploader) reads beyond end of input file (Uploadable)
262 * new-downloader does not tolerate overreads
263 * uploader does lots of tiny reads (inefficient)
264 
265 This fixes the last two. The uploader still does a single overread at the end
266 of the input file, but now that's ok so we can leave it in place. The
267 uploader now expects the Uploadable to behave like a normal disk
268 file (reading beyond EOF will return less data than was asked for), and now
269 the new-downloadable behaves that way.
270]
271[add misc/build_helpers/test-with-fake-pkg.py. refs #1190
272david-sarah@jacaranda.org**20101029025150
273 Ignore-this: 995f220962708f1bad83092161130f67
274]
275[bundled zetuptoolz: if __main__.__requires__ exists then do not add packages to the working set if they provide an incompatible version of a package. Also put a complete __requires__ listing the transitive closure of dependencies at the beginning of generated scripts, rather than a shallow __requires__ specifying only the application version. refs #1190
276david-sarah@jacaranda.org**20101029223111
277 Ignore-this: a95f1967884340e53bf3adf90db40cfc
278]
279[setup.py, misc/build_helpers/run_trial.py: use undocumented __requires__ variable to cause setuptools/zetuptoolz to put the correct versions of dependencies on sys.path. Also ensure that run_trial adds the bundled zetuptoolz egg at the start of sys.path if present. Make the source directory comparison work correctly for the test-with-fake-pkg build step. refs #1190
280david-sarah@jacaranda.org**20101029222825
281 Ignore-this: 8b09366eb6ce3d55c7db5239077a0fac
282]
283[test_runner.py: fix error in BinTahoe.test_version_no_noise introduced by last patch. refs #1235
284david-sarah@jacaranda.org**20101029221123
285 Ignore-this: 4bf21ea34768e8e6adf104e56f939fd0
286]
287[test_runner.py: also allow 'from pkg_resources import load_entry_point' as noise. refs #1235.
288david-sarah@jacaranda.org**20101029204246
289 Ignore-this: a47440aa2cdd29ce55ac7c6c7f4bcaf2
290]
291[test_runner.py: if the only noise is 'UserWarning: Unbuilt egg for setuptools', skip instead of failing the no_noise tests. This version avoids 'any' to be compatible with Python < 2.5. refs #1235.
292david-sarah@jacaranda.org**20101029191804
293 Ignore-this: 83ca1543fc9673e664a8eeefe1eba429
294]
295[NEWS: clarify (strengthen) description of what backdoors.rst declares, and add bugfix entries for 'tahoe cp' and Windows console bugs. refs #1216, #1224, #1232
296david-sarah@jacaranda.org**20101028180046
297 Ignore-this: 1c3eef3cd353b06b6ee00ce87c5ef59a
298]
299[startstop_node.py: pyflakes import fix. refs #1190
300david-sarah@jacaranda.org**20101028014805
301 Ignore-this: 369ef5022c8ee5a0d8341af01553bcef
302]
303['tahoe start': use import+call rather than find+spawn
304"Brian Warner <warner@lothar.com>"**20101027061342
305 
306 This removes the need to use a locally-built (dependency) bin/twistd, and
307 removes a big chunk of behavior differences between unix and windows. It
308 also happens to resolve the "client node probably started" uncertainty.
309 Might help with #1190, #602, and #71.
310]
311[make ResponseCache smarter to avoid memory leaks: don't record timestamps, use DataSpans to merge entries, and clear the cache when we see a new seqnum. refs #1045, #1229
312david-sarah@jacaranda.org**20101027043302
313 Ignore-this: 88fd6fba7f35a2f8af1693b92718f5f3
314]
315[windows/fixups.py: limit length of string passed in a single call to WriteConsoleW. fixes #1232.
316david-sarah@jacaranda.org**20101027021636
317 Ignore-this: fbd99e0d22493974696d37925d97c7d6
318]
319[docs/known_issues.rst: Add section on traffic analysis. Fix URL for current version of file.
320david-sarah@jacaranda.org**20101024234259
321 Ignore-this: f3416e79d3bb833f5118da23e85723ad
322]
323[test_mutable.py: add test for ResponseCache memory leak. refs #1045, #1129
324david-sarah@jacaranda.org**20101024193409
325 Ignore-this: 3aee7f0677956cc6deaccb4d5b8e415f
326]
327[docs/running.html: fix missing end-quote, and change frontends/ doc references to .rst.
328david-sarah@jacaranda.org**20101024171500
329 Ignore-this: 47c645a6595e1790b1d1adfa71af0e1d
330]
331[docs/running.html: 'tahoe create-client' now creates a node with storage disabled. Also change configuration.txt references to configuration.rst.
332david-sarah@jacaranda.org**20101024170431
333 Ignore-this: e5b048055494ba3505bb8a506610681c
334]
335[test_encodingutil.py: test_argv_to_unicode modified the wrong encoding variable. fixes #1214
336david-sarah@jacaranda.org**20101023035810
337 Ignore-this: e5f1f849931b96939facc53d93ff61c5
338]
339[doc: add explanation of the motivation for the surprising and awkward API to erasure coding
340zooko@zooko.com**20101015060202
341 Ignore-this: 428913ff6e1bf5b393deffb1f20b949b
342]
343[setup: catch and log ValueError from locale.getdefaultlocale() in show-tool-versions.py
344zooko@zooko.com**20101015054440
345 Ignore-this: 827d91490562c32ed7cf6526dfded773
346 I got a bug report from Mathias Baert showing that locale.getdefaultlocale() raises an exception on his Mac OS X system. Heh.
347]
348[docs: update how-to-make-a-release doc with a few tweaks from the 1.8.0 process
349zooko@zooko.com**20101015054413
350 Ignore-this: ca5e9478531a3393792ae283239549dd
351]
352[docs: update NEWS ref: #1216
353zooko@zooko.com**20101015053719
354 Ignore-this: 2e0b92e4145d667cdf075e64b7965530
355]
356[docs: fix tab-vs-spaces, make some CLI examples <tt>/"literal", wrap some to
357Brian Warner <warner@lothar.com>**20101015060606
358 Ignore-this: eae08bdf0afb19a2fbf41c31e70a8122
359 80-cols, remove spurious whitespace. Add rst2html.py rule to Makefile.
360]
361[docs: add Peter Secor, Shawn Willden, and Terrell Russell as signatories to docs/backdoors.rst
362zooko@zooko.com**20101015053242
363 Ignore-this: c77adf819d664f673e17c4aaeb353f33
364]
365[docs: convert all .txt docs to .rst thanks to Ravi Pinjala
366zooko@zooko.com**20101015052913
367 Ignore-this: 178a5122423189ecfc45b142314a78ec
368 fixes #1225
369]
370[docs: add statement on our refusal to insert backdoors
371zooko@zooko.com**20101006051147
372 Ignore-this: 644d308319a7b80c4434bdff9760404a
373]
374[setup: add --multi-version to the "setup.py develop" command-line
375zooko@zooko.com**20101005182350
376 Ignore-this: 709155cc21caff29826b8d41a8c8d63d
377 fixes #530. I earlier tried this twice (see #530 for history) and then twice rolled it back due to some problems that arose. However, I didn't write down what the problems were in enough detail on the ticket that I can tell today whether those problems are still issues, so here goes the third attempt. (I did write down on the ticket that it would not create site.py or .pth files in the target directory with --multi-version mode, but I didn't explain why *that* was a problem.)
378]
379[setup: use execfile to access _auto_deps.py in its proper location of src/allmydata/ instead of copying it into place when setup.py is executed
380zooko@zooko.com**20100906055714
381 Ignore-this: c179b42672d775580afad40121f86812
382]
383[trivial: M-x whitespace-cleanup
384zooko@zooko.com**20100903144712
385 Ignore-this: 1bb764d11ac69b4a35ea091cfb13158a
386]
387[minor: remove unused interface declaration, change allmydata.org to tahoe-lafs.org in email address, fix wording in relnotes.txt
388zooko@zooko.com**20100930153708
389 Ignore-this: a452969228afed2774de375e29fa3048
390]
391[immutable/repairer.py: don't use the default happiness setting when repairing
392Kevan Carstensen <kevan@isnotajoke.com>**20100927200102
393 Ignore-this: bd704d9744b970849da8d46a16b8089a
394]
395[NEWS: note dependency updates to pycryptopp and pycrypto.
396david-sarah@jacaranda.org**20100924191207
397 Ignore-this: eeaf5c9c9104f24c450c2ec4482ac1ee
398]
399[TAG allmydata-tahoe-1.8.0
400zooko@zooko.com**20100924021631
401 Ignore-this: 494ca0a885c5e20c883845fc53e7ab5d
402]
403Patch bundle hash:
4044eae2c02661b8c06ac5a497fa12c4b8c7a094852