[newcube] Make the generated code PEP-8 compliant
authorChristophe de Vienne <christophe@unlish.com>
Fri, 06 Feb 2015 14:43:40 +0100
changeset 10214 88f60d4b9952
parent 10213 e53cc2182cf8
child 10215 96085e379066
[newcube] Make the generated code PEP-8 compliant Closes #4925396
devtools/devctl.py
skeleton/__pkginfo__.py.tmpl
skeleton/migration/postcreate.py.tmpl
skeleton/setup.py
skeleton/test/pytestconf.py
skeleton/test/realdb_test_CUBENAME.py
skeleton/test/test_CUBENAME.py.tmpl
--- a/devtools/devctl.py	Sun Aug 31 18:04:46 2014 +0200
+++ b/devtools/devctl.py	Fri Feb 06 14:43:40 2015 +0100
@@ -579,8 +579,8 @@
 # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 # details.
 #
-# You should have received a copy of the GNU Lesser General Public License along
-# with this program. If not, see <http://www.gnu.org/licenses/>.
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
 ''',
 
         'GPL': '''\
@@ -591,7 +591,8 @@
 #
 # This program is distributed in the hope that it will be useful, but WITHOUT
 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
 #
 # You should have received a copy of the GNU General Public License along with
 # this program. If not, see <http://www.gnu.org/licenses/>.
--- a/skeleton/__pkginfo__.py.tmpl	Sun Aug 31 18:04:46 2014 +0200
+++ b/skeleton/__pkginfo__.py.tmpl	Fri Feb 06 14:43:40 2015 +0100
@@ -13,7 +13,7 @@
 description = '%(shortdesc)s'
 web = 'http://www.cubicweb.org/project/%%s' %% distname
 
-__depends__ =  %(dependencies)s
+__depends__ = %(dependencies)s
 __recommends__ = {}
 
 classifiers = [
@@ -29,6 +29,7 @@
 
 THIS_CUBE_DIR = join('share', 'cubicweb', 'cubes', modname)
 
+
 def listdir(dirpath):
     return [join(dirpath, fname) for fname in _listdir(dirpath)
             if fname[0] != '.' and not fname.endswith('.pyc')
@@ -40,9 +41,9 @@
     [THIS_CUBE_DIR, [fname for fname in glob('*.py') if fname != 'setup.py']],
     ]
 # check for possible extended cube layout
-for dname in ('entities', 'views', 'sobjects', 'hooks', 'schema', 'data', 'wdoc', 'i18n', 'migration'):
+for dname in ('entities', 'views', 'sobjects', 'hooks', 'schema', 'data',
+              'wdoc', 'i18n', 'migration'):
     if isdir(dname):
         data_files.append([join(THIS_CUBE_DIR, dname), listdir(dname)])
 # Note: here, you'll need to add subdirectories if you want
 # them to be included in the debian package
-
--- a/skeleton/migration/postcreate.py.tmpl	Sun Aug 31 18:04:46 2014 +0200
+++ b/skeleton/migration/postcreate.py.tmpl	Fri Feb 06 14:43:40 2015 +0100
@@ -11,4 +11,3 @@
 
 # Example of site property change
 #set_property('ui.site-title', "<sitename>")
-
--- a/skeleton/setup.py	Sun Aug 31 18:04:46 2014 +0200
+++ b/skeleton/setup.py	Fri Feb 06 14:43:40 2015 +0100
@@ -16,8 +16,8 @@
 # FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
 # details.
 #
-# You should have received a copy of the GNU Lesser General Public License along
-# with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
+# You should have received a copy of the GNU Lesser General Public License
+# along with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
 """Generic Setup script, takes package info from __pkginfo__.py file
 """
 __docformat__ = "restructuredtext en"
@@ -25,11 +25,11 @@
 import os
 import sys
 import shutil
-from os.path import isdir, exists, join, walk
+from os.path import exists, join, walk
 
 try:
     if os.environ.get('NO_SETUPTOOLS'):
-        raise ImportError() # do as there is no setuptools
+        raise ImportError()  # do as there is no setuptools
     from setuptools import setup
     from setuptools.command import install_lib
     USE_SETUPTOOLS = True
@@ -41,7 +41,7 @@
 
 # import required features
 from __pkginfo__ import modname, version, license, description, web, \
-     author, author_email, classifiers
+    author, author_email, classifiers
 
 if exists('README'):
     long_description = file('README').read()
@@ -52,10 +52,10 @@
 import __pkginfo__
 if USE_SETUPTOOLS:
     requires = {}
-    for entry in ("__depends__",): # "__recommends__"):
+    for entry in ("__depends__",):  # "__recommends__"):
         requires.update(getattr(__pkginfo__, entry, {}))
     install_requires = [("%s %s" % (d, v and v or "")).strip()
-                       for d, v in requires.iteritems()]
+                        for d, v in requires.iteritems()]
 else:
     install_requires = []
 
@@ -82,6 +82,7 @@
         scripts_ = linux_scripts
     return scripts_
 
+
 def export(from_dir, to_dir,
            blacklist=BASE_BLACKLIST,
            ignore_ext=IGNORED_EXTENSIONS,
@@ -150,13 +151,15 @@
             old_install_data.run(self)
             self.install_dir = _old_install_dir
     try:
-        import setuptools.command.easy_install # only if easy_install available
+        # only if easy_install available
+        import setuptools.command.easy_install  # noqa
         # monkey patch: Crack SandboxViolation verification
         from setuptools.sandbox import DirectorySandbox as DS
         old_ok = DS._ok
+
         def _ok(self, path):
             """Return True if ``path`` can be written during installation."""
-            out = old_ok(self, path) # here for side effect from setuptools
+            out = old_ok(self, path)  # here for side effect from setuptools
             realpath = os.path.normcase(os.path.realpath(path))
             allowed_path = os.path.normcase(sys.prefix)
             if realpath.startswith(allowed_path):
@@ -166,6 +169,7 @@
     except ImportError:
         pass
 
+
 def install(**kwargs):
     """setup entry point"""
     if USE_SETUPTOOLS:
@@ -181,21 +185,22 @@
         kwargs['zip_safe'] = False
         cmdclass['install_data'] = MyInstallData
 
-    return setup(name = distname,
-                 version = version,
-                 license = license,
-                 description = description,
-                 long_description = long_description,
-                 author = author,
-                 author_email = author_email,
-                 url = web,
-                 scripts = ensure_scripts(scripts),
-                 data_files = data_files,
-                 ext_modules = ext_modules,
-                 cmdclass = cmdclass,
-                 classifiers = classifiers,
+    return setup(name=distname,
+                 version=version,
+                 license=license,
+                 description=description,
+                 long_description=long_description,
+                 author=author,
+                 author_email=author_email,
+                 url=web,
+                 scripts=ensure_scripts(scripts),
+                 data_files=data_files,
+                 ext_modules=ext_modules,
+                 cmdclass=cmdclass,
+                 classifiers=classifiers,
                  **kwargs
                  )
 
-if __name__ == '__main__' :
+
+if __name__ == '__main__':
     install()
--- a/skeleton/test/pytestconf.py	Sun Aug 31 18:04:46 2014 +0200
+++ b/skeleton/test/pytestconf.py	Fri Feb 06 14:43:40 2015 +0100
@@ -13,8 +13,8 @@
 # FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
 # details.
 #
-# You should have received a copy of the GNU Lesser General Public License along
-# with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
+# You should have received a copy of the GNU Lesser General Public License
+# along with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
 """
 
 """
@@ -23,6 +23,7 @@
 
 from logilab.common.pytest import PyTester
 
+
 def getlogin():
     """avoid usinng os.getlogin() because of strange tty / stdin problems
     (man 3 getlogin)
--- a/skeleton/test/realdb_test_CUBENAME.py	Sun Aug 31 18:04:46 2014 +0200
+++ b/skeleton/test/realdb_test_CUBENAME.py	Fri Feb 06 14:43:40 2015 +0100
@@ -13,14 +13,15 @@
 # FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
 # details.
 #
-# You should have received a copy of the GNU Lesser General Public License along
-# with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
+# You should have received a copy of the GNU Lesser General Public License
+# along with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
 """
 
 """
 from cubicweb.devtools.testlib import CubicWebTC
 from cubicweb.devtools.realdbtest import buildconfig, loadconfig
 
+
 def setUpModule(options):
     if options.source:
         configcls = loadconfig(options.source)
@@ -28,13 +29,13 @@
         raise Exception('either <sourcefile> or <dbname> options are required')
     else:
         configcls = buildconfig(options.dbuser, options.dbpassword,
-                                               options.dbname, options.euser,
-                                               options.epassword)
+                                options.dbname,
+                                options.euser, options.epassword)
     RealDatabaseTC.configcls = configcls
 
 
 class RealDatabaseTC(CubicWebTC):
-    configcls = None # set by setUpModule()
+    configcls = None  # set by setUpModule()
 
     def test_all_primaries(self):
         for rset in self.iter_individual_rsets(limit=50):
--- a/skeleton/test/test_CUBENAME.py.tmpl	Sun Aug 31 18:04:46 2014 +0200
+++ b/skeleton/test/test_CUBENAME.py.tmpl	Fri Feb 06 14:43:40 2015 +0100
@@ -27,6 +27,7 @@
 
 from cubicweb.devtools import testlib
 
+
 class DefaultTC(testlib.CubicWebTC):
     def test_something(self):
         self.skipTest('this cube has no test')