# HG changeset patch # User Sylvain Thénault # Date 1287165138 -7200 # Node ID c46b3b3291e8608e3049c9a6ae5701d04185041d # Parent 6e998b1be7fdc24c7829487b7e97c9924e1a8150# Parent 8c8529db5f83ca15c0923241843b1e2f146bca37 backport stable diff -r 6e998b1be7fd -r c46b3b3291e8 __init__.py --- a/__init__.py Fri Oct 15 17:57:27 2010 +0200 +++ b/__init__.py Fri Oct 15 19:52:18 2010 +0200 @@ -146,4 +146,3 @@ CW_EVENT_MANAGER.bind(event, func, *args, **kwargs) return func return _decorator -import cubicweb.__setuptools_hack__ diff -r 6e998b1be7fd -r c46b3b3291e8 __pkginfo__.py --- a/__pkginfo__.py Fri Oct 15 17:57:27 2010 +0200 +++ b/__pkginfo__.py Fri Oct 15 19:52:18 2010 +0200 @@ -96,7 +96,13 @@ else: pydir = join('python' + _pyversion, 'site-packages') +# data files that shall be copied into the main package directory +package_data = { + 'cubicweb.web.views':['*.pt'], + } + try: + # data files that shall be copied outside the main package directory data_files = [ # server data [join('share', 'cubicweb', 'schemas'), @@ -119,10 +125,6 @@ [join(_wdocimages_dir, fname) for fname in listdir(_wdocimages_dir)]], [join('share', 'cubicweb', 'cubes', 'shared', 'i18n'), [join(_i18n_dir, fname) for fname in listdir(_i18n_dir)]], - # XXX: drop .pt files - [join('lib', pydir, 'cubicweb', 'web', 'views'), - [join(_views_dir, fname) for fname in listdir(_views_dir) - if fname.endswith('.pt')]], # skeleton ] except OSError: diff -r 6e998b1be7fd -r c46b3b3291e8 __setuptools_hack__.py --- a/__setuptools_hack__.py Fri Oct 15 17:57:27 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -from os import path as osp -import sys -import os - -def in_egg(path): - head, tail = osp.split(path) - while tail: - if tail.endswith('.egg'): - return True - head, tail = osp.split(head) - return False - -if in_egg(__file__): - from cubicweb.cwconfig import _find_prefix - INSTALL_PREFIX = _find_prefix() - if not osp.exists(osp.join(INSTALL_PREFIX, 'share', 'cubicweb', 'migration')): - print >> sys.stderr, 'copying cubicweb content to the expected location' - from shutil import copytree - import tarfile - import tempfile - from pkg_resources import Requirement, resource_filename - from functools import partial - file_path = partial(resource_filename, Requirement.parse("cubicweb")) - for df in ('share', 'lib'): - # Tar are used to merge with destination directory - tmp_file = tempfile.NamedTemporaryFile(suffix='.tar') - tmp_tar = tarfile.TarFile(tmp_file.name, mode='w') - tmp_tar.add(file_path(df), arcname=df) - tmp_tar = tarfile.TarFile(tmp_file.name, mode='r') - tmp_tar.extractall(path=INSTALL_PREFIX) diff -r 6e998b1be7fd -r c46b3b3291e8 debian/control --- a/debian/control Fri Oct 15 17:57:27 2010 +0200 +++ b/debian/control Fri Oct 15 19:52:18 2010 +0200 @@ -7,7 +7,7 @@ Adrien Di Mascio , Aurélien Campéas , Nicolas Chauvat -Build-Depends: debhelper (>= 5), python-dev (>=2.5), python-central (>= 0.5), python-sphinx, logilab-doctools +Build-Depends: debhelper (>= 5), python-dev (>=2.5), python-central (>= 0.5) Standards-Version: 3.8.0 Homepage: http://www.cubicweb.org XS-Python-Version: >= 2.5, << 2.7 diff -r 6e998b1be7fd -r c46b3b3291e8 debian/cubicweb-documentation.install.in --- a/debian/cubicweb-documentation.install.in Fri Oct 15 17:57:27 2010 +0200 +++ b/debian/cubicweb-documentation.install.in Fri Oct 15 19:52:18 2010 +0200 @@ -1,1 +1,2 @@ +doc/book usr/share/doc/cubicweb-documentation debian/cubicweb-doc usr/share/doc-base/cubicweb-doc diff -r 6e998b1be7fd -r c46b3b3291e8 debian/rules --- a/debian/rules Fri Oct 15 17:57:27 2010 +0200 +++ b/debian/rules Fri Oct 15 19:52:18 2010 +0200 @@ -38,8 +38,6 @@ # Put all the python library and data in cubicweb-common # and scripts in cubicweb-server - # build doc - BUILDDIR=${PWD}/debian/tmp/cubicweb-book/en make -e -C doc/book/en html dh_install -vi # cwctl in the cubicweb-ctl package rm -f debian/cubicweb-common/usr/share/pyshared/cubicweb/cwctl.py diff -r 6e998b1be7fd -r c46b3b3291e8 devtools/qunit.py --- a/devtools/qunit.py Fri Oct 15 17:57:27 2010 +0200 +++ b/devtools/qunit.py Fri Oct 15 19:52:18 2010 +0200 @@ -11,6 +11,7 @@ from logilab.common.testlib import unittest_main, with_tempdir, InnerTest import os +from os.path import expanduser import cubicweb from cubicweb.view import StartupView from cubicweb.web.controller import Controller @@ -53,15 +54,19 @@ stdout = TemporaryFile() stderr = TemporaryFile() try: - check_call(['firefox', '-no-remote', '-CreateProfile', - '%s %s' % (self._profile_name, self._tmp_dir)], - stdout=stdout, stderr=stderr) + home = expanduser('~') + user = os.getlogin() + assert os.access(home, os.W_OK), \ + 'No write access to your home directory, Firefox will crash.'\ + ' Are you sure "%s" is a valid home for user "%s"' % (home, user) + check_call(['firefox', '-no-remote', '-CreateProfile', + '%s %s' % (self._profile_name, self._tmp_dir)], + stdout=stdout, stderr=stderr) except CalledProcessError, cpe: stdout.seek(0) stderr.seek(0) raise VerboseCalledProcessError(cpe.returncode, cpe.cmd, stdout.read(), stderr.read()) - def start(self, url): self.stop() fnull = open(os.devnull, 'w') diff -r 6e998b1be7fd -r c46b3b3291e8 setup.py --- a/setup.py Fri Oct 15 17:57:27 2010 +0200 +++ b/setup.py Fri Oct 15 19:52:18 2010 +0200 @@ -61,7 +61,7 @@ data_files = getattr(__pkginfo__, 'data_files', None) subpackage_of = getattr(__pkginfo__, 'subpackage_of', None) ext_modules = getattr(__pkginfo__, 'ext_modules', None) - +package_data = getattr(__pkginfo__, 'package_data', {}) BASE_BLACKLIST = ('CVS', 'debian', 'dist', 'build', '__buildlog') IGNORED_EXTENSIONS = ('.pyc', '.pyo', '.elc') @@ -164,7 +164,9 @@ dest = join(self.install_dir, base, directory) export(directory, dest, verbose=False) +# write required share/cubicweb/cubes/__init__.py class MyInstallData(install_data.install_data): + """A class That manages data files installation""" def run(self): """overridden from install_data class""" install_data.install_data.run(self) @@ -173,6 +175,33 @@ ini.write('# Cubicweb cubes directory\n') ini.close() +# re-enable copying data files in sys.prefix +if USE_SETUPTOOLS: + # overwrite MyInstallData to use sys.prefix instead of the egg directory + MyInstallMoreData = MyInstallData + class MyInstallData(MyInstallMoreData): + """A class that manages data files installation""" + def run(self): + _old_install_dir = self.install_dir + if self.install_dir.endswith('egg'): + self.install_dir = sys.prefix + MyInstallMoreData.run(self) + self.install_dir = _old_install_dir + try: + import setuptools.command.easy_install # only if easy_install avaible + # 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) + realpath = os.path.normcase(os.path.realpath(path)) + if realpath.startswith(sys.prefix): + out = True + return out + DS._ok = _ok + except ImportError: + pass def install(**kwargs): """setup entry point""" @@ -194,12 +223,14 @@ if USE_SETUPTOOLS: kwargs['install_requires'] = install_requires kwargs['packages'] = packages + kwargs['package_data'] = package_data return setup(name=distname, version=version, license=license, url=web, description=description, long_description=long_description, author=author, author_email=author_email, scripts=ensure_scripts(scripts), data_files=data_files, ext_modules=ext_modules, - cmdclass={'install_lib': MyInstallLib, 'install_data': MyInstallData}, + cmdclass={'install_lib': MyInstallLib, + 'install_data': MyInstallData}, **kwargs )