Commit dbe07a77 authored by Denis Laxalde's avatar Denis Laxalde
Browse files

[cwconfig] Look for migration scripts directory relatively to code

Thus getting rid of the last piece of data in "shared" directory.
As a consequence, we can drop data_files from __pkginfo__.py.

Related to #17132990.

--HG--
branch : 3.26
parent 1f792d76fca3
......@@ -19,9 +19,6 @@
"""cubicweb global packaging information for the cubicweb knowledge management
software
"""
from os import listdir
from os.path import join
modname = distname = "cubicweb"
......@@ -41,22 +38,8 @@ classifiers = [
'Programming Language :: JavaScript',
]
_server_migration_dir = join(modname, 'misc', 'migration')
# data files that shall be copied into the main package directory
package_data = {
'cubicweb.web.views': ['*.pt'],
'cubicweb.pyramid': ['development.ini.tmpl'],
}
try:
# data files that shall be copied outside the main package directory
data_files = [
# server data
[join('share', 'cubicweb', 'migration'),
[join(_server_migration_dir, filename)
for filename in listdir(_server_migration_dir)]],
]
except OSError:
# we are in an installed directory, don't care about this
pass
......@@ -1011,9 +1011,8 @@ the repository',
@classmethod
def migration_scripts_dir(cls):
"""cubicweb migration scripts directory"""
mdir = join(_INSTALL_PREFIX, 'share', 'cubicweb', 'migration')
if not exists(mdir):
raise ConfigurationError('migration path %s doesn\'t exist' % mdir)
mdir = join(dirname(__file__), 'misc', 'migration')
assert exists(mdir), 'migration path %s does not exist' % mdir
return mdir
@classmethod
......
......@@ -125,6 +125,12 @@ class CubicWebConfigurationTC(BaseTestCase):
ApptestConfiguration.CUBES_PATH = []
cleanup_sys_modules([self.datapath('libpython')])
def test_migration_scripts_dir(self):
mscripts = os.listdir(self.config.migration_scripts_dir())
self.assertIn('bootstrapmigration_repository.py', mscripts)
self.assertIn('postcreate.py', mscripts)
self.assertIn('3.24.0_Any.py', mscripts)
@patch('pkg_resources.iter_entry_points', side_effect=iter_entry_points)
def test_available_cubes(self, mock_iter_entry_points):
expected_cubes = [
......
......@@ -47,7 +47,6 @@ with io.open('README', encoding='utf-8') as f:
# import optional features
distname = __pkginfo__['distname']
data_files = __pkginfo__['data_files']
package_data = __pkginfo__['package_data']
......@@ -62,7 +61,6 @@ setup(
author_email=author_email,
packages=find_packages(),
package_data=package_data,
data_files=data_files,
include_package_data=True,
install_requires=[
'six >= 1.4.0',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment