srcfile = allmydata.__file__
rootdir = get_root_from_file(srcfile)
-bintahoe = os.path.join(rootdir, 'bin', 'tahoe')
-if sys.platform == "win32":
- bintahoe += ".pyscript"
- if not os.path.exists(bintahoe):
- alt_bintahoe = os.path.join(rootdir, 'Scripts', 'tahoe.pyscript')
- if os.path.exists(alt_bintahoe):
- bintahoe = alt_bintahoe
+if hasattr(sys, 'frozen'):
+ bintahoe = os.path.join(rootdir, 'tahoe')
+ if sys.platform == "win32" and os.path.exists(bintahoe + '.exe'):
+ bintahoe += '.exe'
+else:
+ bintahoe = os.path.join(rootdir, 'bin', 'tahoe')
+ if sys.platform == "win32":
+ bintahoe += '.pyscript'
+ if not os.path.exists(bintahoe):
+ alt_bintahoe = os.path.join(rootdir, 'Scripts', 'tahoe.pyscript')
+ if os.path.exists(alt_bintahoe):
+ bintahoe = alt_bintahoe
class RunBinTahoeMixin:
def run_bintahoe(self, args, stdin=None, python_options=[], env=None):
self.skip_if_cannot_run_bintahoe()
- command = [sys.executable] + python_options + [bintahoe] + args
+
+ if hasattr(sys, 'frozen'):
+ if python_options:
+ raise unittest.SkipTest("This test doesn't apply to frozen builds.")
+ command = [bintahoe] + args
+ else:
+ command = [sys.executable] + python_options + [bintahoe] + args
+
if stdin is None:
stdin_stream = None
else:
class BinTahoe(common_util.SignalMixin, unittest.TestCase, RunBinTahoeMixin):
def _check_right_code(self, file_to_check):
root_to_check = get_root_from_file(file_to_check)
+ if os.path.basename(root_to_check) == 'dist':
+ root_to_check = os.path.dirname(root_to_check)
+
cwd = os.path.normcase(os.path.realpath("."))
root_from_cwd = os.path.dirname(cwd)
if os.path.basename(root_from_cwd) == 'src':
return d
def test_run_with_python_options(self):
- self.skip_if_cannot_run_bintahoe()
-
# -t is a harmless option that warns about tabs.
d = self.run_bintahoe(["--version"], python_options=["-t"])
def _cb(res):
--- /dev/null
+
+# This checks that we can import the right versions of all dependencies.
+# Import this first to suppress deprecation warnings.
+import allmydata
+
+# nevow requires all these for its voodoo module import time adaptor registrations
+from nevow import accessors, appserver, static, rend, url, util, query, i18n, flat
+from nevow import guard, stan, testutil, context
+from nevow.flat import flatmdom, flatstan, twist
+from formless import webform, processors, annotate, iformless
+from decimal import Decimal
+from xml.dom import minidom
+
+import allmydata.web
+
+import mock
+
+# junk to appease pyflakes's outrage
+[
+ accessors, appserver, static, rend, url, util, query, i18n, flat, guard, stan, testutil,
+ context, flatmdom, flatstan, twist, webform, processors, annotate, iformless, Decimal,
+ minidom, allmydata, mock,
+]
+
+from allmydata.scripts import runner
+
+runner.run()
\ No newline at end of file