Commit Graph

273 Commits

Author SHA1 Message Date
david-sarah
f9d218c673 encodingutil: argv and output encodings are always the same on all platforms. Lose the unnecessary generality of them being different. fixes #1120 2011-06-29 11:53:56 -07:00
Brian Warner
2f63d9b522 immutable/upload.py: reduce use of get_serverid() 2011-02-26 19:11:38 -07:00
Brian Warner
ee14f2ad67 happinessutil.py: finally rename merge_peers to merge_servers 2011-02-26 19:11:24 -07:00
Brian Warner
459b9d9e7c happinessutil.py: server-vs-tracker cleanup 2011-02-26 19:11:11 -07:00
Brian Warner
ebfcb649f9 refactor: s/peer/server/ in immutable/upload, happinessutil.py, test_upload
No behavioral changes, just updating variable/method names and log messages.
The effects outside these three files should be minimal: some exception
messages changed (to say "server" instead of "peer"), and some internal class
names were changed. A few things still use "peer" to minimize external
changes, like UploadResults.timings["peer_selection"] and
happinessutil.merge_peers, which can be changed later.
2011-02-26 19:11:00 -07:00
david-sarah
b6c2c9591d src/allmydata/util/iputil.py: correct an error in the address-matching regexps introduced by the previous patch to iputil. refs #1274 2011-01-20 23:21:36 -08:00
david-sarah
b1f15a630a Add src/allmydata/util/verlib.py, which is a copy of verlib from https://bitbucket.org/tarek/distutilsversion/src/17df9a7d96ef . It is used to normalize and compare versions of dependencies. refs #1258 2011-01-20 22:04:49 -08:00
david-sarah
d5138b3237 src/allmydata/util/iputil.py: loosen regexps and ensure that 'LANG=en_US.UTF-8' is set in the environment, to minimize problems with localized output of IP-address-finding tools. refs #1274 2011-01-20 00:48:27 -08:00
david-sarah
6dd8b6f471 Eliminate dependencies on pywin32, even via Twisted. refs #1274 2011-01-19 20:32:38 -08:00
david-sarah
d21f4071c3 Eliminate direct dependencies of Tahoe-LAFS on pywin32 (rebased to trunk). refs #1274 2011-01-18 23:59:11 -08:00
david-sarah
399ee5aea0 Remove src/allmydata/util/find_exe.py which is no longer used. fixes #1150 2010-12-25 18:32:06 -08:00
Zooko O'Whielacronx
d5e71c2940 fileutil: copy in the get_disk_stats() and get_available_space() functions from storage/server.py 2010-09-10 08:35:20 -08:00
Zooko O'Whielacronx
e6a380241a trivial: M-x whitespace-cleanup 2010-09-03 07:47:12 -07:00
Brian Warner
43c5032105 util/spans.py: __nonzero__ cannot return a long either. for #1154 2010-08-05 11:55:07 -07:00
david-sarah
cd8d41584e test_storage.py: change skip note for test_large_share to say that Windows doesn't support sparse files. refs #569 2010-08-04 19:26:12 -07:00
Brian Warner
8844655705 One fix for bug #1154: webapi GETs with a 'Range' header broke new-downloader.
The Range header causes n.read() to be called with an offset= of type 'long',
which eventually got used in a Spans/DataSpans object's __len__ method.
Apparently python doesn't permit __len__() to return longs, only ints.
Rewrote Spans/DataSpans to use s.len() instead of len(s) aka s.__len__() .
Added a test in test_download. Note that test_web didn't catch this because
it uses mock FileNodes for speed: it's probably time to rewrite that.

There is still an unresolved error-recovery problem in #1154, so I'm not
closing the ticket quite yet.
2010-08-04 11:45:49 -07:00
Brian Warner
919938dd95 copy the rest of David-Sarah's changes to make my tree match 1.8.0beta 2010-08-04 00:27:52 -07:00
Brian Warner
88d7ec2d54 util/observer.py: add EventStreamObserver 2010-08-04 00:26:12 -07:00
Brian Warner
cbcb728e7e Add a byte-spans utility class, like perl's Set::IntSpan for .newsrc files.
Also a data-spans class, which records a byte (instead of a bit) for each
index.
2010-08-04 00:26:00 -07:00
david-sarah
37b07a545f Changes to Tahoe needed to work with new zetuptoolz (that does not use .exe wrappers on Windows), and to support Unicode arguments and stdout/stderr -- v5 2010-07-25 01:32:16 -07:00
david-sarah
013954c265 fileutil: change WindowsError to OSError in abspath_expanduser_unicode, because WindowsError might not exist. 2010-07-25 15:26:03 -07:00
david-sarah
f036dfaa4b Fix test failures due to Unicode basedir patches. 2010-07-24 18:03:18 -07:00
david-sarah
28e6ad51a7 util.encodingutil: change quote_output to do less unnecessary escaping, and to use double-quotes more consistently when needed. This version avoids u-escaping for characters that are representable in the output encoding, when double quotes are used, and includes tests. fixes #1135 2010-07-23 00:53:14 -07:00
david-sarah
11b18824c7 util.fileutil, test.test_util: add abspath_expanduser_unicode function, to work around <http://bugs.python.org/issue3426>. util.encodingutil: add a convenience function argv_to_abspath. 2010-07-21 16:15:07 -07:00
Zooko O'Whielacronx
9b4f412e49 trivial: rename and add in-line doc to clarify "used_peers" => "upload_servers" 2010-07-18 21:47:44 -07:00
Zooko O'Whielacronx
13b5e44fbc immutable: fix bug in which preexisting_shares and merged were shallowly referencing the same sets
This bug had the effect of making uploads sometimes (rarely) appear to succeed when they had actually not distributed the shares well enough to achieve the desired servers-of-happiness level.
2010-07-19 00:54:26 -07:00
francois
968edfda11 iputil.py: Add support for FreeBSD 7,8 and 9
committed by: zooko@zooko.com
date: 2010-07-17
and I also patched: NEWS and CREDITS
2010-07-17 19:28:32 -07:00
david-sarah
752897450d fileutil: docstrings for non-obvious usage restrictions on methods of EncryptedTemporaryFile. 2010-07-16 22:46:47 -07:00
david-sarah
05022dca36 Move EncryptedTemporaryFile from SFTP frontend to allmydata.util.fileutil, and make the FTP frontend also use it (fixing #1083). 2010-07-11 14:37:21 -07:00
david-sarah
a8161c915a Correct stringutils->encodingutil patch to be the newer version, rather than the old version that was committed in error. 2010-07-17 18:34:35 -07:00
david-sarah
11077ea74d Rename stringutils to encodingutil, and drop listdir_unicode and open_unicode (since the Python stdlib functions work fine with Unicode paths). Also move some utility functions to fileutil. 2010-07-11 17:30:15 -07:00
david-sarah
b8df25a8d1 stringutils.py: tolerate sys.stdout having no 'encoding' attribute. 2010-06-25 21:08:17 -07:00
david-sarah
7e7644589a stringutils.py: remove unused import. 2010-06-16 20:44:40 -07:00
david-sarah
9f5488b2d1 stringutils.py: don't NFC-normalize the output of listdir_unicode. 2010-06-16 18:55:37 -07:00
david-sarah
e2c7ad1d88 stringutils.py: Add encoding argument to quote_output. Also work around a bug in locale.getpreferredencoding on older Pythons. 2010-06-15 21:20:12 -07:00
david-sarah
ffd1c5aca5 Fix for Unicode-related test failures on Zooko's OS X 10.6 machine. 2010-06-08 22:54:48 -07:00
david-sarah
80a89d3931 stringutils.py, sftpd.py: Portability fixes for Python <= 2.5. 2010-06-08 18:33:02 -07:00
david-sarah
32d9deace3 Back out Windows-specific Unicode argument support for v1.7. 2010-06-08 17:08:03 -07:00
david-sarah
80252debcd Unicode fixes. 2010-06-06 18:02:15 -07:00
Zooko O'Whielacronx
db8a6f3aa6 unicode: make test_cli test a non-ascii argument, and make the fallback term encoding be locale.getpreferredencoding() 2010-06-04 07:12:51 -07:00
Francois Deppierraz
d0ed14e1bb stringutils.py: Unicode helper functions + associated tests
This file contains a bunch of helper functions which converts
unicode string from and to argv, filenames and stdout.
2010-05-19 17:41:05 -07:00
david-sarah
e76092e16c Change relative imports to absolute 2010-02-26 01:14:33 -07:00
Kevan Carstensen
e225f573b9 Fix up the behavior of #778, per reviewers' comments
- Make some important utility functions clearer and more thoroughly 
    documented.
  - Assert in upload.servers_of_happiness that the buckets attributes
    of PeerTrackers passed to it are mutually disjoint.
  - Get rid of some silly non-Pythonisms that I didn't see when I first
    wrote these patches.
  - Make sure that should_add_server returns true when queried about a 
    shnum that it doesn't know about yet.
  - Change Tahoe2PeerSelector.preexisting_shares to map a shareid to a set
    of peerids, alter dependencies to deal with that.
  - Remove upload.should_add_servers, because it is no longer necessary
  - Move upload.shares_of_happiness and upload.shares_by_server to a utility
    file.
  - Change some points in Tahoe2PeerSelector.
  - Compute servers_of_happiness using a bipartite matching algorithm that 
    we know is optimal instead of an ad-hoc greedy algorithm that isn't.
  - Change servers_of_happiness to just take a sharemap as an argument,
    change its callers to merge existing_shares and used_peers before 
    calling it.
  - Change an error message in the encoder to be more appropriate for 
    servers of happiness.
  - Clarify the wording of an error message in immutable/upload.py
  - Refactor a happiness failure message to happinessutil.py, and make
    immutable/upload.py and immutable/encode.py use it.
  - Move the word "only" as far to the right as possible in failure 
    messages.
  - Use a better definition of progress during peer selection.
  - Do read-only peer share detection queries in parallel, not sequentially.
  - Clean up logging semantics; print the query statistics whenever an
    upload is unsuccessful, not just in one case.
2010-05-13 17:49:17 -07:00
Zooko O'Whielacronx
80ae6f2706 setup: fix error in licensing declaration from Shawn Willden, as noted by the FSF compliance division 2010-03-09 08:37:36 -08:00
david-sarah
c984a09fe7 Fix race conditions and missing callback in allmydata.test.test_cli.Cp.test_copy_using_filecap, add utilities for one-liner reading and writing of files, and fix cases in test_cli where files were not being closed after writing. 2010-02-05 17:37:27 -08:00
Brian Warner
731d15e56f hush pyflakes-0.4.0 warnings: remove trivial unused variables. For #900. 2010-01-14 14:15:29 -08:00
Brian Warner
d888bf3377 Clean up log.err calls, for one of the issues in #889.
allmydata.util.log.err() either takes a Failure as the first positional
argument, or takes no positional arguments and must be invoked in an
exception handler. Fixed its signature to match both foolscap.logging.log.err
and twisted.python.log.err . Included a brief unit test.
2010-01-11 17:33:43 -08:00
Brian Warner
bacb6fe5aa tidy up DeadReferenceError handling, ignore them in add_lease calls
Stop checking separately for ConnectionDone/ConnectionLost, since those have
been folded into DeadReferenceError since foolscap-0.3.1 . Write
rrefutil.trap_deadref() in terms of rrefutil.trap_and_discard() to improve
code coverage.
2010-01-11 16:07:23 -08:00
Brian Warner
a4a6c02ef8 more #859: avoid deprecation warning for unit tests too, hush pyflakes
* factor maybe-import-sha logic into util.hashutil
2009-12-14 16:01:47 -08:00
Zooko O'Whielacronx
4706859967 setup: ignore _darcs in the "test-clean" test and make the "clean" step remove all .egg's in the root dir 2009-12-06 10:48:35 -08:00