Commit Graph

102 Commits

Author SHA1 Message Date
Jean-Paul Calderone
13409a2449 Move the remaining package checking machinery to its own module. 2019-08-13 15:11:01 -04:00
Jean-Paul Calderone
2df3f9805b Remove another unused piece of support code. 2019-08-13 14:16:38 -04:00
Jean-Paul Calderone
6623ed3e4b Remove import-time dependency version checks. 2019-08-13 14:10:36 -04:00
heartsucker
ae5e282e2f
update raise syntax for python3 compatibility 2019-04-05 11:39:10 +02:00
heartsucker
0750dbac38
updated all python files to use pep-3110 exception syntax for python3 compatibility 2019-04-04 11:57:58 +02:00
Jean-Paul Calderone
5ed375b145 Add more complexity to the package sanity checking
Support comma-separated lists of extras
2019-01-23 14:58:44 -05:00
Brian Warner
da4e7dcfbe hush a bunch of not-really-problems caught by the lgtm.com static analyzer
This is all minor stuff: unreachable debug code (that should be commented-out
instead of in an 'if False:' block), unnecessary 'pass' and 'global'
statements, redundantly-initialized variables. No behavior changes. Nothing
here was actually broken, it just looked suspicious to the static analysis at
https://lgtm.com/projects/g/tahoe-lafs/tahoe-lafs/alerts/?mode=list .
2017-12-31 00:19:41 +01:00
Brian Warner
b637636ef9 remove _appname.py file
We no longer need the complexity of choosing the application name at
runtime. This removes the setup.py code which populates the _appname.py
file, and the code in __init__.py which reads it. It does not yet remove
the tests which compare the output of e.g. `tahoe --version` against
`allmydata.__appname__`, which I think could be removed, but that's more
invasive than I want to do right now.

closes ticket:2754
2016-08-11 23:24:11 -07:00
Daira Hopwood
2e91068da1 Use version information from pkg_resources when we can't get it from import.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-03-15 17:31:32 +00:00
Daira Hopwood
8ddfc3def0 Tolerate IrrationalVersionError when parsing version numbers of dependencies,
without a warning. fixes ticket:2733

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-03-15 17:31:32 +00:00
Daira Hopwood
a4dfc31a19 Avoid spurious errors when an imported version is consistent with pkg_resources
but not parseable; also improve related error reporting. fixes ticket:2499

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2015-09-12 00:59:51 +01:00
Daira Hopwood
2c99294a4f Don't show scary diagnostic warnings from --version[-and-path] (corrected). refs ticket:2436
The previous version would incorrectly add to the output of
get_package_versions_string each time it was called.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2015-07-29 00:20:33 +01:00
Daira Hopwood
3239527929 Revert "Don't show scary diagnostic warnings from --version[-and-path]"
This reverts commit 431728f8f8.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2015-07-29 00:20:33 +01:00
Daira Hopwood
19df54927d Minor code cleanup in __init__.py.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2015-07-21 18:55:47 +01:00
Daira Hopwood
431728f8f8 Don't show scary diagnostic warnings from --version[-and-path]
if the only problem is that extra packages are found by pkg_resources.
fixes ticket:2436

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2015-07-21 18:51:29 +01:00
Daira Hopwood
96024d7244 Add OpenSSL version check and tests. refs ticket:2215
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2015-06-02 18:07:20 +01:00
Daira Hopwood
e73d76eb1b Latest cryptography depends on enum34.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2015-01-20 10:52:07 -08:00
Daira Hopwood
ef455df990 dependecy specs: tolerate new PEP440 semantics too
The latest setuptools (version 8) changed the way dependency
specifications ("I can handle libfoo version 2 or 3, but not 4") are
interpreted. The new version follows PEP440, which is simpler but
somewhat less expressive. Tahoe's _auto_deps.py now uses dep-specs which
are correctly parsed by both old and new setuptools.

Fixes ticket:2354.

* Restrict the requirements in _auto_deps.py to work with either the old
  or PEP 440 semantics.
* Update check_requirement and tests to take account of changes for PEP
  440 compatibility.
* Fix an error message.
* Remove a superfluous TODO.
2015-01-20 10:52:02 -08:00
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