mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-18 18:56:28 +00:00
Merge pull request #579 from tahoe-lafs/3001-python3-syntax-check
python3 syntax check
This commit is contained in:
commit
6970c2cc6d
19
.travis.yml
19
.travis.yml
@ -22,7 +22,13 @@ install:
|
||||
- python misc/build_helpers/show-tool-versions.py
|
||||
|
||||
script:
|
||||
- tox -e ${T}
|
||||
- |
|
||||
set -eo pipefail
|
||||
if [ "${T}" = "py35" ]; then
|
||||
cat py3_valid_syntax.txt | xargs python3 -m compileall -f
|
||||
else
|
||||
tox -e ${T}
|
||||
fi
|
||||
|
||||
after_success:
|
||||
- if [ "${T}" = "coverage" ]; then codecov; fi
|
||||
@ -40,17 +46,28 @@ notifications:
|
||||
matrix:
|
||||
include:
|
||||
- os: linux
|
||||
python: '2.7'
|
||||
env: T=coverage LANG=en_US.UTF-8
|
||||
- os: linux
|
||||
python: '2.7'
|
||||
env: T=codechecks LANG=en_US.UTF-8
|
||||
- os: linux
|
||||
python: '2.7'
|
||||
env: T=pyinstaller LANG=en_US.UTF-8
|
||||
- os: linux
|
||||
python: '2.7'
|
||||
env: T=py27 LANG=C
|
||||
- os: osx
|
||||
python: '2.7'
|
||||
env: T=py27 LANG=en_US.UTF-8
|
||||
language: generic # "python" is not available on OS-X
|
||||
- os: osx
|
||||
python: '2.7'
|
||||
env: T=pyinstaller LANG=en_US.UTF-8
|
||||
language: generic # "python" is not available on OS-X
|
||||
# this is a "lint" job that checks for python3 compatibility
|
||||
- os: linux
|
||||
python: '3.5'
|
||||
env: T=py35
|
||||
|
||||
fast_finish: true
|
||||
|
@ -11,6 +11,7 @@ def foldlines(s, numlines=None):
|
||||
lines = lines[:numlines]
|
||||
return " ".join(lines).replace("\r", "")
|
||||
|
||||
|
||||
def print_platform():
|
||||
try:
|
||||
import platform
|
||||
@ -24,16 +25,18 @@ def print_platform():
|
||||
traceback.print_exc(file=sys.stderr)
|
||||
sys.stderr.flush()
|
||||
|
||||
|
||||
def print_python_ver():
|
||||
print("python:", foldlines(sys.version))
|
||||
print('maxunicode: ' + str(sys.maxunicode))
|
||||
|
||||
|
||||
def print_python_encoding_settings():
|
||||
print('filesystem.encoding: ' + str(sys.getfilesystemencoding()))
|
||||
print('locale.getpreferredencoding: ' + str(locale.getpreferredencoding()))
|
||||
try:
|
||||
print('locale.defaultlocale: ' + str(locale.getdefaultlocale()))
|
||||
except ValueError, e:
|
||||
except ValueError as e:
|
||||
print('got exception from locale.getdefaultlocale(): ', e)
|
||||
print('locale.locale: ' + str(locale.getlocale()))
|
||||
|
||||
@ -43,8 +46,8 @@ def print_stdout(cmdlist, label=None, numlines=None):
|
||||
label = cmdlist[0]
|
||||
res = subprocess.Popen(cmdlist, stdin=open(os.devnull),
|
||||
stdout=subprocess.PIPE).communicate()[0]
|
||||
print(label + ': ' + foldlines(res, numlines))
|
||||
except EnvironmentError, e:
|
||||
print(label + ': ' + foldlines(res.decode('utf-8'), numlines))
|
||||
except EnvironmentError as e:
|
||||
if isinstance(e, OSError) and e.errno == 2:
|
||||
print(label + ': no such file or directory')
|
||||
return
|
||||
@ -52,14 +55,16 @@ def print_stdout(cmdlist, label=None, numlines=None):
|
||||
traceback.print_exc(file=sys.stderr)
|
||||
sys.stderr.flush()
|
||||
|
||||
|
||||
def print_as_ver():
|
||||
if os.path.exists('a.out'):
|
||||
print("WARNING: a file named a.out exists, and getting the version of the 'as' assembler writes to that filename, so I'm not attempting to get the version of 'as'.")
|
||||
print("WARNING: a file named a.out exists, and getting the version of the 'as' assembler "
|
||||
"writes to that filename, so I'm not attempting to get the version of 'as'.")
|
||||
return
|
||||
try:
|
||||
res = subprocess.Popen(['as', '-version'], stdin=open(os.devnull),
|
||||
stdout, stderr = subprocess.Popen(['as', '-version'], stdin=open(os.devnull),
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
|
||||
print('as: ' + foldlines(res[0]+' '+res[1]))
|
||||
print('as: ' + foldlines(stdout.decode('utf-8') + ' ' + stderr.decode('utf-8')))
|
||||
if os.path.exists('a.out'):
|
||||
os.remove('a.out')
|
||||
except EnvironmentError:
|
||||
@ -67,6 +72,7 @@ def print_as_ver():
|
||||
traceback.print_exc(file=sys.stderr)
|
||||
sys.stderr.flush()
|
||||
|
||||
|
||||
def print_setuptools_ver():
|
||||
try:
|
||||
import pkg_resources
|
||||
@ -79,6 +85,7 @@ def print_setuptools_ver():
|
||||
except pkg_resources.DistributionNotFound:
|
||||
print('setuptools: DistributionNotFound')
|
||||
|
||||
|
||||
def print_py_pkg_ver(pkgname, modulename=None):
|
||||
if modulename is None:
|
||||
modulename = pkgname
|
||||
@ -105,6 +112,7 @@ def print_py_pkg_ver(pkgname, modulename=None):
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
|
||||
print_platform()
|
||||
print()
|
||||
print_python_ver()
|
||||
|
1
newsfragments/3001.other
Normal file
1
newsfragments/3001.other
Normal file
@ -0,0 +1 @@
|
||||
Added a simple sytax checker so that once a file has reached python3 compatibility, it will not regress.
|
165
py3_valid_syntax.txt
Normal file
165
py3_valid_syntax.txt
Normal file
@ -0,0 +1,165 @@
|
||||
docs/
|
||||
integration/
|
||||
misc/build_helpers/test-osx-pkg.py
|
||||
misc/coding_tools/check-debugging.py
|
||||
misc/coding_tools/coverage2el.py
|
||||
misc/coding_tools/fixshebangs.py
|
||||
misc/coding_tools/graph-deps.py
|
||||
misc/incident-gatherer/classify_tahoe.py
|
||||
misc/operations_helpers/provisioning/provisioning.py
|
||||
misc/operations_helpers/provisioning/reliability.py
|
||||
misc/operations_helpers/provisioning/run.py
|
||||
misc/operations_helpers/provisioning/test_provisioning.py
|
||||
misc/operations_helpers/provisioning/util.py
|
||||
misc/operations_helpers/provisioning/web_reliability.py
|
||||
misc/operations_helpers/spacetime/diskwatcher.py
|
||||
release-tools/
|
||||
setup.py
|
||||
src/allmydata/_auto_deps.py
|
||||
src/allmydata/check_results.py
|
||||
src/allmydata/client.py
|
||||
src/allmydata/codec.py
|
||||
src/allmydata/control.py
|
||||
src/allmydata/deep_stats.py
|
||||
src/allmydata/frontends/auth.py
|
||||
src/allmydata/frontends/__init__.py
|
||||
src/allmydata/hashtree.py
|
||||
src/allmydata/history.py
|
||||
src/allmydata/immutable/downloader/common.py
|
||||
src/allmydata/immutable/downloader/fetcher.py
|
||||
src/allmydata/immutable/downloader/finder.py
|
||||
src/allmydata/immutable/downloader/__init__.py
|
||||
src/allmydata/immutable/downloader/status.py
|
||||
src/allmydata/immutable/filenode.py
|
||||
src/allmydata/immutable/__init__.py
|
||||
src/allmydata/immutable/layout.py
|
||||
src/allmydata/immutable/literal.py
|
||||
src/allmydata/immutable/offloaded.py
|
||||
src/allmydata/immutable/repairer.py
|
||||
src/allmydata/interfaces.py
|
||||
src/allmydata/introducer/
|
||||
src/allmydata/__main__.py
|
||||
src/allmydata/monitor.py
|
||||
src/allmydata/mutable/checker.py
|
||||
src/allmydata/mutable/common.py
|
||||
src/allmydata/mutable/__init__.py
|
||||
src/allmydata/mutable/layout.py
|
||||
src/allmydata/mutable/publish.py
|
||||
src/allmydata/mutable/repairer.py
|
||||
src/allmydata/mutable/servermap.py
|
||||
src/allmydata/nodemaker.py
|
||||
src/allmydata/scripts/admin.py
|
||||
src/allmydata/scripts/cli.py
|
||||
src/allmydata/scripts/common.py
|
||||
src/allmydata/scripts/default_nodedir.py
|
||||
src/allmydata/scripts/__init__.py
|
||||
src/allmydata/scripts/stats_gatherer.py
|
||||
src/allmydata/scripts/tahoe_add_alias.py
|
||||
src/allmydata/scripts/tahoe_backup.py
|
||||
src/allmydata/scripts/tahoe_invite.py
|
||||
src/allmydata/scripts/tahoe_restart.py
|
||||
src/allmydata/scripts/tahoe_run.py
|
||||
src/allmydata/scripts/tahoe_start.py
|
||||
src/allmydata/scripts/tahoe_status.py
|
||||
src/allmydata/storage_client.py
|
||||
src/allmydata/storage/
|
||||
src/allmydata/test/cli/common.py
|
||||
src/allmydata/test/cli/__init__.py
|
||||
src/allmydata/test/cli/test_alias.py
|
||||
src/allmydata/test/cli/test_create.py
|
||||
src/allmydata/test/cli/test_daemonize.py
|
||||
src/allmydata/test/cli/test_invite.py
|
||||
src/allmydata/test/cli/test_start.py
|
||||
src/allmydata/test/cli/test_status.py
|
||||
src/allmydata/test/common_web.py
|
||||
src/allmydata/test/eliotutil.py
|
||||
src/allmydata/test/__init__.py
|
||||
src/allmydata/test/mutable/__init__.py
|
||||
src/allmydata/test/mutable/test_checker.py
|
||||
src/allmydata/test/mutable/test_datahandle.py
|
||||
src/allmydata/test/mutable/test_different_encoding.py
|
||||
src/allmydata/test/mutable/test_exceptions.py
|
||||
src/allmydata/test/mutable/test_filehandle.py
|
||||
src/allmydata/test/mutable/test_filenode.py
|
||||
src/allmydata/test/mutable/test_interoperability.py
|
||||
src/allmydata/test/mutable/test_multiple_encodings.py
|
||||
src/allmydata/test/mutable/test_multiple_versions.py
|
||||
src/allmydata/test/mutable/test_repair.py
|
||||
src/allmydata/test/mutable/test_servermap.py
|
||||
src/allmydata/test/mutable/util.py
|
||||
src/allmydata/test/plugins/tahoe_lafs_dropin.py
|
||||
src/allmydata/test/status.py
|
||||
src/allmydata/test/test_auth.py
|
||||
src/allmydata/test/test_backupdb.py
|
||||
src/allmydata/test/test_checker.py
|
||||
src/allmydata/test/test_client.py
|
||||
src/allmydata/test/test_configutil.py
|
||||
src/allmydata/test/test_connections.py
|
||||
src/allmydata/test/test_eliotutil.py
|
||||
src/allmydata/test/test_encode.py
|
||||
src/allmydata/test/test_filenode.py
|
||||
src/allmydata/test/test_happiness.py
|
||||
src/allmydata/test/test_helper.py
|
||||
src/allmydata/test/test_hung_server.py
|
||||
src/allmydata/test/test_i2p_provider.py
|
||||
src/allmydata/test/test_immutable.py
|
||||
src/allmydata/test/test_import.py
|
||||
src/allmydata/test/test_inotify.py
|
||||
src/allmydata/test/test_introducer.py
|
||||
src/allmydata/test/test_iputil.py
|
||||
src/allmydata/test/test_json_metadata.py
|
||||
src/allmydata/test/test_magicpath.py
|
||||
src/allmydata/test/test_multi_introducers.py
|
||||
src/allmydata/test/test_netstring.py
|
||||
src/allmydata/test/test_no_network.py
|
||||
src/allmydata/test/test_observer.py
|
||||
src/allmydata/test/test_runner.py
|
||||
src/allmydata/test/test_stats.py
|
||||
src/allmydata/test/test_storage_client.py
|
||||
src/allmydata/test/test_tor_provider.py
|
||||
src/allmydata/test/test_uri.py
|
||||
src/allmydata/test/test_version.py
|
||||
src/allmydata/test/web/common.py
|
||||
src/allmydata/test/web/__init__.py
|
||||
src/allmydata/test/web/test_introducer.py
|
||||
src/allmydata/test/web/test_root.py
|
||||
src/allmydata/test/web/test_token.py
|
||||
src/allmydata/test/web/test_util.py
|
||||
src/allmydata/unknown.py
|
||||
src/allmydata/util/abbreviate.py
|
||||
src/allmydata/util/base32.py
|
||||
src/allmydata/util/base62.py
|
||||
src/allmydata/util/cachedir.py
|
||||
src/allmydata/util/configutil.py
|
||||
src/allmydata/util/connection_status.py
|
||||
src/allmydata/util/consumer.py
|
||||
src/allmydata/util/dictutil.py
|
||||
src/allmydata/util/eliotutil.py
|
||||
src/allmydata/util/hashutil.py
|
||||
src/allmydata/util/i2p_provider.py
|
||||
src/allmydata/util/idlib.py
|
||||
src/allmydata/util/__init__.py
|
||||
src/allmydata/util/keyutil.py
|
||||
src/allmydata/util/limiter.py
|
||||
src/allmydata/util/log.py
|
||||
src/allmydata/util/mathutil.py
|
||||
src/allmydata/util/namespace.py
|
||||
src/allmydata/util/netstring.py
|
||||
src/allmydata/util/nummedobj.py
|
||||
src/allmydata/util/observer.py
|
||||
src/allmydata/util/pipeline.py
|
||||
src/allmydata/util/pkgresutil.py
|
||||
src/allmydata/util/progress.py
|
||||
src/allmydata/util/repeatable_random.py
|
||||
src/allmydata/util/rrefutil.py
|
||||
src/allmydata/util/sibpath.py
|
||||
src/allmydata/util/statistics.py
|
||||
src/allmydata/util/tor_provider.py
|
||||
src/allmydata/util/verlib.py
|
||||
src/allmydata/util/yamlutil.py
|
||||
src/allmydata/watchdog/
|
||||
src/allmydata/web/
|
||||
src/allmydata/webish.py
|
||||
src/allmydata/windows/__init__.py
|
||||
src/allmydata/windows/tahoesvc.py
|
||||
static/tahoe.py
|
@ -539,7 +539,7 @@ class DirectoryNodeHandler(RenderMixin, rend.Page, ReplaceMeMixin):
|
||||
body = req.content.read()
|
||||
try:
|
||||
children = json.loads(body)
|
||||
except ValueError, le:
|
||||
except ValueError as le:
|
||||
le.args = tuple(le.args + (body,))
|
||||
# TODO test handling of bad JSON
|
||||
raise
|
||||
@ -1017,7 +1017,8 @@ class ManifestResults(MultiFormatPage, ReloadMixin):
|
||||
def data_items(self, ctx, data):
|
||||
return self.monitor.get_status()["manifest"]
|
||||
|
||||
def render_row(self, ctx, (path, cap)):
|
||||
def render_row(self, ctx, path_cap):
|
||||
path, cap = path_cap
|
||||
ctx.fillSlots("path", self.slashify_path(path))
|
||||
root = get_root(ctx)
|
||||
# TODO: we need a clean consistent way to get the type of a cap string
|
||||
|
Loading…
Reference in New Issue
Block a user