Commit Graph

84 Commits

Author SHA1 Message Date
Daira Hopwood
ea09305987 Refactoring to move the not_import_versionable and ignorable package lists to _auto_deps.py.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2014-10-02 16:42:44 +01:00
Brian Warner
d27a57cb49 Avoid Popen() of executables that don't exist
The stdlib 'subprocess' module in python-2.7.4 through 2.7.7 suffers
from http://bugs.python.org/issue18851 which causes unrelated file
descriptors to be closed when `subprocess.call()` fails the `exec()`,
such as when the executable being invoked does not actually exist. There
appears to be some randomness involved. This was fixed in python-2.7.8.

Tahoe's iputil.py uses subprocess.call on many different "ifconfig"-type
executables, most of which don't exist on any given platform (added in
git commit 8e31d66cd0). This results in a lot of file-descriptor
closing, which (at least during unit tests) tends to clobber important
things like Tub TCP sockets. This seems to be the root cause behind
ticket:2121, in which normal code tries to close already-closed sockets,
crashing the unit tests. Since different platforms have different
ifconfigs, some platforms will experience more failed execs than others,
so this bug could easily behave differently on linux vs freebsd, as well
as working normally on python-2.7.8 or 2.7.4.

This patch inserts a guard to make sure that os.path.isfile() is true
before allowing Popen.call() to try executing the target. This ought to
be enough to avoid the bug. It changes both iputil.py and
allmydata.__init__ (which uses Popen for calling "lsb_release"), which
are all the places where 'subprocess' is used outside of unit tests.

Other potential fixes: use the 'subprocess32' module from PyPI (which is
a bug-free backport of the Python3 stdlib subprocess module, but would
introduce a new dependency), or require python >= 2.7.8 (but this would
rule out development/deployment on the current OS-X 10.9 release, which
ships with 2.7.5, as well as other distributions like Ubuntu 14.04 LTS).

I believe this closes ticket:2121, and given the apparent relationship
between 2121 and 2023, I think it also closes ticket:2023 (although
since 2023 doesn't have copies of the failing log files, it's hard to
tell). I'm hoping that this will tide us over until 1.11 is released, at
which point we can execute on the plan to remove iputil.py entirely by
changing the way that nodes learn their externally-facing IP address.
2014-09-12 13:01:56 -07:00
travis-tahoe
036c325d35 Suppress all UserWarnings, not just ones with known messages. refs #2248
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2014-09-01 19:39:57 +01:00
Daira Hopwood
8a1b2c7aa6 Show git branch in version output. fixes #1953
Also make sure strings in _version.py are correctly escaped, and repair a test.

Signed-off-by: Daira Hopwood <david-sarah@jacaranda.org>
2013-05-01 22:38:08 +01:00
David-Sarah Hopwood
7008ffa55e Require at least Python 2.6. fixes #1658
Signed-off-by: David-Sarah Hopwood <david-sarah@jacaranda.org>
2013-03-15 05:13:30 +00:00
david-sarah
36c176224d src/allmydata/__init__.py: ensure that if a dependency cannot be imported, we will report that rather than reporting a confusing message about the version and location being None. fixes #1804 2012-09-14 02:14:48 +00:00
david-sarah
37ee8f79d5 src/allmydata/__init__.py: head off a possible warning on platforms where twisted-conch is a separate package. 2011-08-08 18:20:13 +00:00
Brian Warner
2ed6b67644 'tahoe --version': remove inconsistent trailing comma, easier to parse 2012-06-26 09:18:45 -07:00
david-sarah
854afc095f Suppress DeprecationWarning about twisted.internet.interfaces.IFinishableConsumer. This also unifies the handling of DeprecationWarnings that need to be suppressed globally. refs #1295 2012-06-14 21:23:08 +00:00
david-sarah
a1a1b5bf8a Simplifications resulting from requiring Python 2.5 and therefore being able to use sqlite3 from the standard library. This also drops sqlite3 from the set of versions and paths we report. 2012-05-16 02:47:25 +00:00
david-sarah
0fc196ea5f Require Python 2.5. 2012-05-16 02:41:49 +00:00
david-sarah
bf7e351464 Improve a comment in __init__.py. 2012-05-14 16:34:31 +00:00
david-sarah
4b80299fdd Suppress the PowmInsecureWarning from PyCrypto. refs #1586 2012-05-14 03:23:52 +00:00
david-sarah
aebaa838da Update various references to allmydata.org or http://tahoe-lafs.org in comments, to https://tahoe-lafs.org. refs #1682 2012-03-08 23:17:19 +00:00
Brian Warner
05dbb1cf86 update project-home URLs: /trac/tahoe/ was replaced by /trac/tahoe-lafs/ 2011-10-30 12:14:28 -07:00
david-sarah
c41bf14029 Cleanups for suppression of UserWarnings. refs #1435 2011-08-17 21:07:49 -07:00
Zooko O'Whielacronx
f627af3b9f suppress warning emitted by newer zope.interface with Nevow 0.10
refs #1435
2011-08-17 13:31:34 -07:00
david-sarah
a48aee11b3 allmydata/__init__.py, test_version.py: make version parsing understand '<=', with test. refs #1435 2011-08-14 20:51:53 -07:00
david-sarah
a85a462a7a src/allmydata/__init__.py: suppress a spurious warning from 'bin/tahoe --version[-and-path]' about twisted-web and twisted-core packages. 2011-07-31 17:52:09 -07:00
Zooko O'Whielacronx
b30a269ec2 setup: don't catch all Exception from check_requirement(), but only PackagingError and ImportError
I noticed this because I had accidentally inserted a bug which caused AssertionError to be raised from check_requirement().
2011-01-28 08:20:06 -07:00
david-sarah
fffb3ae75b Fix a test failure in test_package_initialization on Python 2.4.x due to exceptions being stringified differently than in later versions of Python. refs #1389 2011-04-11 12:07:38 -07:00
david-sarah
449b7ad8c7 allmydata/__init__.py: preserve the message and last traceback entry (file, line number, function, and source line) of ImportErrors in the package versions string. fixes #1389 2011-04-10 08:57:05 -07:00
Zooko O'Whielacronx
4911510e0d remove unused variable detected by pyflakes 2011-04-07 10:22:31 -07:00
david-sarah
f3246a9ca0 allmydata/__init__.py: Nicer reporting of unparseable version numbers in dependencies. fixes #1388 2011-04-01 13:27:50 -07:00
david-sarah
787d12165a Add unit tests for cross_check_pkg_resources_versus_import, and a regression test for ref #1355. This requires a little refactoring to make it testable. 2011-02-20 17:58:17 -08:00
david-sarah
71c301ca34 allmydata/__init__.py: .name was used in place of the correct .__name__ when printing an exception. Also, robustify string formatting by using %r instead of %s in some places. fixes #1355. 2011-02-20 18:01:25 -08:00
david-sarah
c71a19b9ed src/allmydata/__init__.py: fix #1339, give an indication in the --version[-and-path] output of when the imported setuptools is distribute, and use a separate element in _vers_and_locs_list tuples for information other than the package name and location. This also changes slightly how the sqlite version is reported. 2011-01-27 21:41:50 -08:00
david-sarah
cb02adb110 Don't put debugging information in 'My versions' section of the Welcome page. Also remove the extra blank line between version and command output when --version[-and-path] is used. refs #1306 2011-01-21 20:02:20 -08:00
david-sarah
29336a0916 Refactor _auto_deps.py and __init__.py, adding more robust checking of dependency versions, and not trusting pkg_resources to get the versions right. refs #1258, #1287 2011-01-20 21:36:10 -08:00
david-sarah
b8905fc766 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. 2010-10-31 17:33:16 -07:00
david-sarah
63c010a9ca allmydata/__init__.py: put the _auto_deps.require_auto_deps() call back in exactly the same place it was prior to [4784]. 2010-10-31 10:46:49 -07:00
david-sarah
7e2ed2054c allmydata/__init__.py: suppress a DeprecationWarning for the sha module on importing pycrypto. 2010-10-31 09:06:36 -07:00
david-sarah
6e76653913 allmydata/__init__.py: call require_auto_deps() after importing nevow and twisted, reverting change in [4784]. Also fix a missing 'warnings.filters.pop()'. 2010-10-31 08:38:28 -07:00
david-sarah
2ab0b1aa2c allmydata.__init__.py: temporary hack to debug failure on midnightmagic's buildslave 2010-10-30 22:50:03 -07:00
Zooko O'Whielacronx
3b2d0d9609 setup: run require_auto_deps() before attempting to import any deps in __init__.py
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.)
2010-10-30 01:10:35 -07:00
david-sarah
fd9a2205de test_runner.py: correct and simplify normalization of package directory for case-insensitive filesystems. 2010-08-08 11:50:05 -07:00
david-sarah
f5bf900d64 src/allmydata/__init__.py: make the package paths more accurate when we fail to get them from setuptools. 2010-08-08 10:12:35 -07:00
Zooko O'Whielacronx
44edecb36c setup: replace hardcoded 'allmydata-tahoe' with allmydata.__appname__ 2010-08-01 09:05:17 -07:00
david-sarah
94bec75dda __init__.py: silence DeprecationWarning about BaseException.message globally. fixes #1129 2010-07-19 18:19:39 -07:00
david-sarah
8ed28a95e7 Move suppression of DeprecationWarning about BaseException.message from sftpd.py to main __init__.py. Also, remove the global suppression of the 'integer argument expected, got float' warning, which turned out to be a bug. 2010-05-28 22:05:37 -07:00
david-sarah
aac94a8d89 Suppress 'integer argument expected, got float' DeprecationWarning everywhere 2010-05-23 15:11:57 -07:00
david-sarah
b8641f8f9b allmydata.org -> tahoe-lafs.org in __init__.py 2010-06-02 23:35:30 -07:00
david-sarah
a80f19a084 Correct harmless indentation errors found by pylint 2010-02-25 23:21:51 -07:00
david-sarah
e76092e16c Change relative imports to absolute 2010-02-26 01:14:33 -07:00
david-sarah
e880fc2ce4 Suppress deprecation warning for twisted.web.error.NoResource when using Twisted >= 9.0.0. 2010-05-16 13:56:25 -07:00
david-sarah
6215ebd95e cli: suppress DeprecationWarnings emitted from importing nevow and twisted. Fixes #859 2010-01-31 16:44:29 -08:00
Zooko O'Whielacronx
2841d6a266 setup: add pysqlite and sqlite to get_package_versions() 2009-06-04 08:37:28 -07:00
Brian Warner
c9803d5217 switch all foolscap imports to use foolscap.api or foolscap.logging 2009-05-21 17:38:23 -07:00
Zooko O'Whielacronx
14d23d99a5 setup: make the "full version string" be "allmydata-tahoe/1.3.0" instead of "allmydata-tahoe-1.3.0" and the UserAgent string of the cli be "allmydata-tahoe/1.3.0 (tahoe-client)"
This is webbish.  Thanks to kpreid for suggesting it.
2009-02-12 22:37:38 -07:00
Zooko O'Whielacronx
7eb260a9cf versioning: include an "appname" in the application version string in the versioning protocol, and make that appname be controlled by setup.py
It is currently hardcoded in setup.py to be 'allmydata-tahoe'.  Ticket #556 is to make it configurable by a runtime command-line argument to setup.py: "--appname=foo", but I suddenly wondered if we really wanted that and at the same time realized that we don't need that for tahoe-1.3.0 release, so this patch just hardcodes it in setup.py.
setup.py inspects a file named 'src/allmydata/_appname.py' and assert that it contains the string "__appname__ = 'allmydata-tahoe'", and creates it if it isn't already present.  src/allmydata/__init__.py import _appname and reads __appname__ from it.  The rest of the Python code imports allmydata and inspects "allmydata.__appname__", although actually every use it uses "allmydata.__full_version__" instead, where "allmydata.__full_version__" is created in src/allmydata/__init__.py to be:

__full_version__ = __appname + '-' + str(__version__).

All the code that emits an "application version string" when describing what version of a protocol it supports (introducer server, storage server, upload helper), or when describing itself in general (introducer client), usese allmydata.__full_version__.

This fixes ticket #556 at least well enough for tahoe-1.3.0 release.
2009-02-11 17:18:16 -07:00