From 6fe7c2c662880214a2b865e84d1c2fc89a927a12 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 24 Apr 2013 09:56:42 +0530 Subject: [PATCH] pep8 --- setup/installer/linux/freeze2.py | 9 +++------ setup/installer/osx/app/main.py | 11 ++++------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/setup/installer/linux/freeze2.py b/setup/installer/linux/freeze2.py index 44b8e81bff..3e79a0287a 100644 --- a/setup/installer/linux/freeze2.py +++ b/setup/installer/linux/freeze2.py @@ -112,7 +112,6 @@ class LinuxFreeze(Command): else: ffi = glob.glob('/usr/lib/libffi.so.?')[-1] - for x in binary_includes + [stdcpp, ffi]: dest = self.bin_dir if '/bin/' in x else self.lib_dir shutil.copy2(x, dest) @@ -226,7 +225,6 @@ class LinuxFreeze(Command): except: self.warn('Failed to byte-compile', y) - def run_builder(self, cmd, verbose=True): p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) @@ -256,7 +254,6 @@ class LinuxFreeze(Command): self.info('Archive %s created: %.2f MB'%(dist, os.stat(dist).st_size/(1024.**2))) - def build_launchers(self): self.obj_dir = self.j(self.src_root, 'build', 'launcher') if not os.path.exists(self.obj_dir): @@ -268,7 +265,8 @@ class LinuxFreeze(Command): cflags = '-fno-strict-aliasing -W -Wall -c -O2 -pipe -DPYTHON_VER="python%s"'%self.py_ver cflags = cflags.split() + ['-I/usr/include/python'+self.py_ver] for src, obj in zip(sources, objects): - if not self.newer(obj, headers+[src, __file__]): continue + if not self.newer(obj, headers+[src, __file__]): + continue cmd = ['gcc'] + cflags + ['-fPIC', '-o', obj, src] self.run_builder(cmd) @@ -330,8 +328,7 @@ class LinuxFreeze(Command): self.run_builder(cmd, verbose=False) - - def create_site_py(self): # {{{ + def create_site_py(self): # {{{ with open(self.j(self.py_dir, 'site.py'), 'wb') as f: f.write(textwrap.dedent('''\ import sys diff --git a/setup/installer/osx/app/main.py b/setup/installer/osx/app/main.py index 2182038088..4c95d9d59c 100644 --- a/setup/installer/osx/app/main.py +++ b/setup/installer/osx/app/main.py @@ -37,7 +37,6 @@ class OSX32_Freeze(Command): action='store_true', help='Only build launchers') - def run(self, opts): global info, warn info, warn = self.info, self.warn @@ -332,7 +331,7 @@ class Py2App(object): def create_plist(self): from calibre.ebooks import BOOK_EXTENSIONS env = dict(**ENV) - env['CALIBRE_LAUNCHED_FROM_BUNDLE']='1'; + env['CALIBRE_LAUNCHED_FROM_BUNDLE']='1' docs = [{'CFBundleTypeName':'E-book', 'CFBundleTypeExtensions':list(BOOK_EXTENSIONS), 'CFBundleTypeRole':'Viewer', @@ -395,7 +394,6 @@ class Py2App(object): self.install_dylib(os.path.join(SW, 'lib', 'libpng12.0.dylib')) self.install_dylib(os.path.join(SW, 'lib', 'libpng.3.dylib')) - @flush def add_fontconfig(self): info('\nAdding fontconfig') @@ -568,7 +566,7 @@ class Py2App(object): @flush def compile_py_modules(self): - info( '\nCompiling Python modules') + info('\nCompiling Python modules') base = join(self.resources_dir, 'Python') for x in os.walk(base): root = x[0] @@ -584,7 +582,7 @@ class Py2App(object): @flush def create_console_app(self): - info( '\nCreating console.app') + info('\nCreating console.app') cc_dir = os.path.join(self.contents_dir, 'console.app', 'Contents') os.makedirs(cc_dir) for x in os.listdir(self.contents_dir): @@ -607,7 +605,6 @@ class Py2App(object): shutil.copy2(join(base, 'site.py'), join(self.resources_dir, 'Python', 'lib', 'python'+self.version_info)) - @flush def makedmg(self, d, volname, destdir='dist', @@ -630,7 +627,7 @@ class Py2App(object): '-volname', volname, '-format', format, dmg]) shutil.rmtree(tdir) if internet_enable: - subprocess.check_call(['/usr/bin/hdiutil', 'internet-enable', '-yes', dmg]) + subprocess.check_call(['/usr/bin/hdiutil', 'internet-enable', '-yes', dmg]) size = os.stat(dmg).st_size/(1024*1024.) info('\nInstaller size: %.2fMB\n'%size) return dmg