[pkg] Properly export data files in setup.py and adjust "newcube" test 3.23
authorDenis Laxalde <denis.laxalde@logilab.fr>
Tue, 05 Jul 2016 13:27:19 +0200
branch3.23
changeset 11422 63ac20ef558e
parent 11421 06bcb7e7a69c
child 11423 aaa768e886ae
[pkg] Properly export data files in setup.py and adjust "newcube" test With the new package layout (everything under "cubicweb" package), the custom install_lib rule which makes use of include_dirs defined in __pkginfo__.py did not prepend the package name to source directories to be copied. Fixing this. Also, in setup.py's export() function, the destination directories' path to be created during source tree walk was wrong. All this makes cubicweb/skeleton directory (which is not a package) properly installed by setup.py. The test in cubicweb/devtools/test/unittest_devctl.py wasn't properly implemented because it used an installation of cubicweb in "develop" mode which shadows such packaging issues. Also it used "python -m cubicweb" instead of directly "cubicweb-ctl" and the former appears to fall back to using the cubicweb package *from sources* instead of the installed one. Now that this test runs against the installed version of cubicweb, fix MANIFEST.in to include tox.ini files (cubicweb's and skeleton's) as this is expected from the test. Closes #14127941.
MANIFEST.in
cubicweb/devtools/test/unittest_devctl.py
setup.py
--- a/MANIFEST.in	Tue Jul 05 10:44:05 2016 +0200
+++ b/MANIFEST.in	Tue Jul 05 13:27:19 2016 +0200
@@ -2,6 +2,7 @@
 include COPYING
 include COPYING.LESSER
 include pylintrc
+include tox.ini
 include bin/cubicweb-*
 include man/cubicweb-ctl.1
 
@@ -41,7 +42,7 @@
 recursive-include cubicweb/web/test/jstests *.js *.html *.css *.json
 recursive-include cubicweb/web/test/windmill *.py
 
-recursive-include cubicweb/skeleton *.py *.css *.js *.po compat *.in *.tmpl rules
+recursive-include cubicweb/skeleton *.py *.css *.js *.po compat *.in *.tmpl rules tox.ini
 
 prune doc/book/en/.static
 prune doc/book/fr/.static
--- a/cubicweb/devtools/test/unittest_devctl.py	Tue Jul 05 10:44:05 2016 +0200
+++ b/cubicweb/devtools/test/unittest_devctl.py	Tue Jul 05 13:27:19 2016 +0200
@@ -27,8 +27,7 @@
 
 
 def newcube(directory, name):
-    cmd = [sys.executable, '-m' 'cubicweb', 'newcube',
-           '--directory', directory, name]
+    cmd = ['cubicweb-ctl', 'newcube', '--directory', directory, name]
     proc = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=STDOUT)
     stdout, _ = proc.communicate(b'short_desc\n')
     return proc.returncode, stdout
--- a/setup.py	Tue Jul 05 10:44:05 2016 +0200
+++ b/setup.py	Tue Jul 05 13:27:19 2016 +0200
@@ -131,7 +131,8 @@
                 if verbose:
                     print('not recursing in %s' % join(dirpath, norecurs))
         for dirname in dirnames:
-            dest = join(to_dir, dirname)
+            src = join(dirpath, dirname)
+            dest = to_dir + src[len(from_dir):]
             if not exists(dest):
                 if verbose:
                     print('creating %s directory' % dest)
@@ -162,8 +163,9 @@
         # manually install included directories if any
         if include_dirs:
             for directory in include_dirs:
-                dest = join(self.install_dir, modname, directory)
-                export(directory, dest, verbose=self.verbose)
+                src = join(modname, directory)
+                dest = join(self.install_dir, src)
+                export(src, dest, verbose=self.verbose)
 
 # write required share/cubicweb/cubes/__init__.py
 class MyInstallData(install_data.install_data):