Skip to content

Commit

Permalink
Update to latest pylint and fix outstanding issues
Browse files Browse the repository at this point in the history
  • Loading branch information
bmaltby committed Jun 25, 2014
1 parent e3cba49 commit 0fd4e77
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 40 deletions.
2 changes: 1 addition & 1 deletion .pylintrc
Expand Up @@ -47,7 +47,7 @@ load-plugins=
# R0903: Too few public methods (%r/%r)
# C0111: Missing docstring
# W0142: Used * or ** magic
disable=C0111,I0011,W0613,E0611,R0903,W0142,R0801,W1401,C0303
disable=C0111,I0011,W0613,E0611,R0903,W0142,R0801,W1401,C0326


[REPORTS]
Expand Down
43 changes: 21 additions & 22 deletions manage.py
Expand Up @@ -66,8 +66,7 @@ def _easy_install(package):
_easy_install('simplejson>=2.1.5')
_easy_install('PyYAML>=3.10')

_easy_install('logilab-common==0.60.0')
_easy_install('pylint==1.0.0')
_easy_install('pylint==1.2.1')

_easy_install('roman>=1.4.0')
_easy_install('docutils>=0.9.1')
Expand All @@ -80,7 +79,7 @@ def _easy_install(package):
os.path.join(TURBULENZROOT, 'scripts', 'install_nodejs.py'),
'--prefix', env_dir,
'--typescript']
if not TURBULENZOS in [ 'linux32', 'linux64' ]:
if not TURBULENZOS in ['linux32', 'linux64']:
cmd.append('-f')
sh(cmd, console=True)

Expand All @@ -100,7 +99,7 @@ def command_env_clean():
def command_jslib(options):

parser = argparse.ArgumentParser(description=" Builds or cleans specified app(s), by name or path. If no app is"
" given, builds or cleans all the listed apps (except samples).")
" given, builds or cleans all the listed apps (except samples).")
parser.add_argument('--clean', action='store_true', help="Clean jslib (completely removes directory!)")
parser.add_argument('--outdir', default=None, help="Build jslib to an alternative directory")
parser.add_argument('--closure', action='store_true', help="Verify the generated .js files with closure")
Expand Down Expand Up @@ -140,7 +139,7 @@ def command_jslib(options):

# If mode == "all", run the modular build, then crude
if "all" == mode:
if 0 != command_jslib(options + [ '--modular' ]):
if 0 != command_jslib(options + ['--modular']):
return 1
mode = "crude"
elif "modular" == mode:
Expand Down Expand Up @@ -173,7 +172,7 @@ def command_jslib(options):
@command_requires_env
@command_with_arguments
def command_jslib_clean(options):
command_jslib([ '--clean' ] + options)
command_jslib(['--clean'] + options)

def _get_num_cpus():
import multiprocessing
Expand Down Expand Up @@ -282,21 +281,21 @@ def command_tools_clean():
@command_requires_env
@command_with_arguments
def command_apps(options):
app_dirs = [ 'samples',
'apps/inputapp',
'apps/multiworm',
'apps/sampleapp',
'apps/templateapp',
'apps/viewer',
'apps/tictactoe',
'apps/protolibsampleapp' ]
app_dirs = [ os.path.join(TURBULENZROOT, p) for p in app_dirs ]
app_dirs = ['samples',
'apps/inputapp',
'apps/multiworm',
'apps/sampleapp',
'apps/templateapp',
'apps/viewer',
'apps/tictactoe',
'apps/protolibsampleapp']
app_dirs = [os.path.join(TURBULENZROOT, p) for p in app_dirs]
all_apps = {}
for d in app_dirs:
all_apps[os.path.split(d)[1]] = d

parser = argparse.ArgumentParser(description=" Builds or cleans specified app(s), by name or path. If no app is"
" given, builds or cleans all the listed apps (except samples).")
" given, builds or cleans all the listed apps (except samples).")
parser.add_argument('--clean', action='store_true', help="Clean specified apps (same as apps-clean)")
parser.add_argument('--refcheck', action='store_true', help="Build with reference checking")
parser.add_argument('--verbose', action='store_true', help="Display verbose build output")
Expand All @@ -312,11 +311,11 @@ def command_apps(options):

if args.app == 'all_apps':
# If no app given, build all apps except samples
apps = [ app for app in all_apps.keys() if app != 'samples' ]
apps = [app for app in all_apps.keys() if app != 'samples']
else:
if args.app not in all_apps and not os.path.exists(args.app):
print "ERROR: app name not recognised: %s" % args.app
apps = [ args.app ]
apps = [args.app]

if not args.mode:
modes = ['canvas-debug', 'canvas']
Expand All @@ -326,8 +325,8 @@ def command_apps(options):
modes = args.mode

if 'plugin-debug' in modes:
warning('**DEPRICATED** plugin-debug has been depricated as a build mode. '
'Please use canvas-debug for debugging. Removing from list of modes.')
warning('**DEPRECATED** plugin-debug has been deprecated as a build mode. '
'Please use canvas-debug for debugging. Removing from list of modes.')
modes = [m for m in modes if m != 'plugin-debug']
if not modes:
error("No remaining modes to build.")
Expand Down Expand Up @@ -382,7 +381,7 @@ def command_apps(options):
app_assets = os.path.abspath(os.path.join(app_dir, 'assets'))
if os.path.isdir(app_assets):
buildassets_cmd.extend(['--assets-path', app_assets])
buildassets_cmd.extend(['--assets-path', os.path.join(TURBULENZROOT, 'assets') ])
buildassets_cmd.extend(['--assets-path', os.path.join(TURBULENZROOT, 'assets')])

if args.verbose:
buildassets_cmd.append('--verbose')
Expand All @@ -409,7 +408,7 @@ def command_apps(options):
@command_requires_env
@command_with_arguments
def command_apps_clean(options):
command_apps([ '--clean' ] + (options or []))
command_apps(['--clean'] + (options or []))

#######################################################################################################################

Expand Down
4 changes: 2 additions & 2 deletions scripts/__init__.py
@@ -1,9 +1,9 @@
# Copyright (c) 2009-2013 Turbulenz Limited
# Copyright (c) 2009-2014 Turbulenz Limited
"""
Turbulenz framework for creating browser based games.
"""

__author__ = "Turbulenz Limited"
__copyright__ = "Copyright (c) 2009-2013 Turbulenz Limited"
__copyright__ = "Copyright (c) 2009-2014 Turbulenz Limited"

TURBULENZ_ENGINE_VERSION = "1.2"
20 changes: 9 additions & 11 deletions scripts/buildassets.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
# Copyright (c) 2013 Turbulenz Limited
# Copyright (c) 2013-2014 Turbulenz Limited

from sys import argv, stdout
from json import loads as load_json, dumps as dump_json
Expand Down Expand Up @@ -394,7 +394,7 @@ def __init__(self, yaml_info):
else:
self.path = normpath(yaml_info['path'])
deps = yaml_info.get('deps', [])
self.deps = [ normpath(d) for d in deps ]
self.deps = [normpath(d) for d in deps]
self.deps.append(self.path)
self.install = yaml_info.get('install', True)
self.args = yaml_info.get('args')
Expand All @@ -413,7 +413,7 @@ def build_asset(asset_info, source_list, tools, build_path, verbose):
create_dir(dirname(dst_path))

source = source_list.get_source(src)
deps = [ source_list.get_source(path) for path in asset_info.deps ]
deps = [source_list.get_source(path) for path in asset_info.deps]
if any([dep.has_changed() for dep in deps]) or asset_tool.has_changed() or not path_exists(dst_path) \
or asset_tool.check_external_deps(source.asset_path, dst_path, asset_info.args):
stdout.write('[%s] %s\n' % (asset_tool.name.upper(), src))
Expand Down Expand Up @@ -514,7 +514,7 @@ def main():

args = parser.parse_args(argv[1:])

assets_paths = [ normpath(p) for p in args.assets_path ]
assets_paths = [normpath(p) for p in args.assets_path]
base_build_path = normpath(args.build_path)
create_dir(base_build_path)
create_dir(args.install_path)
Expand Down Expand Up @@ -559,7 +559,7 @@ def run(self):
# build it. This could iterate down the remaining list in case the head isn't buildable but
# things later in the list are
asset_info = self.asset_list[0]
deps = [ source_list.get_source(path) for path in asset_info.deps if path != asset_info.path ]
deps = [source_list.get_source(path) for path in asset_info.deps if path != asset_info.path]
if any([not d.built for d in deps]):
self.mutex.release()
sleep(0.01)
Expand Down Expand Up @@ -591,14 +591,14 @@ def run(self):
if asset in assets_to_build:
continue
for dep in asset.deps:
if dep != asset.path and dep not in [ a.path for a in assets_to_build ]:
if dep != asset.path and dep not in [a.path for a in assets_to_build]:
break
else:
assets_to_build.append(asset)
if num_assets_sorted == len(assets_to_build):
assets_left = [ a for a in asset_build_info if a not in assets_to_build ]
assets_left = [a for a in asset_build_info if a not in assets_to_build]
error('Detected cyclic dependencies between assets within - \n%s' %
'\n'.join([ a.path for a in assets_left ]))
'\n'.join([a.path for a in assets_left]))
return 1


Expand Down Expand Up @@ -638,9 +638,7 @@ def run(self):
print 'Installing assets and building mapping table...'
mapping = install(asset_build_info, args.install_path)
with open('mapping_table.json', 'w') as f:
f.write(dump_json({
'urnmapping': mapping
}))
f.write(dump_json({'urnmapping': mapping}))

# Cleanup any built files no longer referenced by the new mapping table
remove_old_build_files(asset_build_info, base_build_path)
Expand Down
6 changes: 3 additions & 3 deletions scripts/install_nodejs.py
Expand Up @@ -75,8 +75,8 @@ def nodejs_install_binary_win32(version, filename, prefix):
tardata = gzipfile.read()
with tarfile.open(fileobj=StringIO.StringIO(tardata), mode='r') as tarobj:
entries = tarobj.getmembers()
npmfiles = [ (e.name.replace(depsprefix, moduledir), e) for e in entries
if e.isfile() and e.name.startswith(npmprefix) ]
npmfiles = [(e.name.replace(depsprefix, moduledir), e) for e in entries
if e.isfile() and e.name.startswith(npmprefix)]
for target, npmfile in npmfiles:
tarentry = tarobj.extractfile(npmfile)
if not os.path.exists(os.path.dirname(target)):
Expand All @@ -100,7 +100,7 @@ def nodejs_install_binary_unix(version, platform, prefix):

download(url, filename)

excludes = [ 'ChangeLog', 'LICENSE', 'README*' ]
excludes = ['ChangeLog', 'LICENSE', 'README*']
tar_cmd = 'tar -xzf %s --strip-components 1 -C %s %s' \
% (filename, prefix, ' '.join(['--exclude "%s"' % e for e in excludes]))

Expand Down
2 changes: 1 addition & 1 deletion scripts/utils.py
Expand Up @@ -170,7 +170,7 @@ def new(arguments=None):
return new

def command_with_arguments(fn):
def new(arguments = None, *args, **kwargs):
def new(arguments=None, *args, **kwargs):
return fn(arguments or [], *args, **kwargs)
return new

Expand Down

0 comments on commit 0fd4e77

Please sign in to comment.