# HG changeset patch # User Sylvain Thénault # Date 1287165034 -7200 # Node ID a3f6dff718b489c9db21a0fea5852eec447e0b16 # Parent 88b3172eb7c74673400d0c7d97160b8d40f5754d Backed out changeset 88b3172eb7c7: alain's patch 6517:c991ad161d8f does a better job at this diff -r 88b3172eb7c7 -r a3f6dff718b4 __init__.py --- a/__init__.py Fri Oct 15 11:39:54 2010 +0200 +++ b/__init__.py Fri Oct 15 19:50:34 2010 +0200 @@ -146,4 +146,3 @@ CW_EVENT_MANAGER.bind(event, func, *args, **kwargs) return func return _decorator -import cubicweb.__setuptools_hack__ diff -r 88b3172eb7c7 -r a3f6dff718b4 __setuptools_hack__.py --- a/__setuptools_hack__.py Fri Oct 15 11:39:54 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)