Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cubicweb
cubicweb
Commits
88f60d4b9952
Commit
789df3d8
authored
Feb 06, 2015
by
Christophe de Vienne
Browse files
[newcube] Make the generated code PEP-8 compliant
Closes #4925396
parent
e53cc2182cf8
Changes
7
Hide whitespace changes
Inline
Side-by-side
devtools/devctl.py
View file @
88f60d4b
...
...
@@ -579,8 +579,8 @@ layout, and a full featured cube with "full" layout.',
# 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 @@ layout, and a full featured cube with "full" layout.',
#
# 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/>.
...
...
skeleton/__pkginfo__.py.tmpl
View file @
88f60d4b
...
...
@@ -13,7 +13,7 @@ author_email = '%(author-email)s'
description = '%(shortdesc)s'
web = 'http://www.cubicweb.org/project/%%s' %% distname
__depends__ =
%(dependencies)s
__depends__ = %(dependencies)s
__recommends__ = {}
classifiers = [
...
...
@@ -29,6 +29,7 @@ from glob import glob
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 @@ data_files = [
[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
skeleton/migration/postcreate.py.tmpl
View file @
88f60d4b
...
...
@@ -11,4 +11,3 @@ You could setup site properties or a workflow here for example.
# Example of site property change
#set_property('ui.site-title', "<sitename>")
skeleton/setup.py
View file @
88f60d4b
...
...
@@ -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 @@ __docformat__ = "restructuredtext en"
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 @@ from distutils.command import install_data
# 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 @@ else:
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 @@ def ensure_scripts(linux_scripts):
scripts_
=
linux_scripts
return
scripts_
def
export
(
from_dir
,
to_dir
,
blacklist
=
BASE_BLACKLIST
,
ignore_ext
=
IGNORED_EXTENSIONS
,
...
...
@@ -150,13 +151,15 @@ if USE_SETUPTOOLS:
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 @@ if USE_SETUPTOOLS:
except
ImportError
:
pass
def
install
(
**
kwargs
):
"""setup entry point"""
if
USE_SETUPTOOLS
:
...
...
@@ -181,21 +185,22 @@ def install(**kwargs):
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
()
skeleton/test/pytestconf.py
View file @
88f60d4b
...
...
@@ -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 @@ import sys
from
logilab.common.pytest
import
PyTester
def
getlogin
():
"""avoid usinng os.getlogin() because of strange tty / stdin problems
(man 3 getlogin)
...
...
skeleton/test/realdb_test_CUBENAME.py
View file @
88f60d4b
...
...
@@ -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 @@ def setUpModule(options):
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
):
...
...
skeleton/test/test_CUBENAME.py.tmpl
View file @
88f60d4b
...
...
@@ -27,6 +27,7 @@ uncomment code below if you want to activate automatic test for your cube:
from cubicweb.devtools import testlib
class DefaultTC(testlib.CubicWebTC):
def test_something(self):
self.skipTest('this cube has no test')
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment