[devtools] Create "newcube" in current directory by default 3.25
authorDenis Laxalde <denis.laxalde@logilab.fr>
Mon, 20 Mar 2017 12:13:04 +0100
branch3.25
changeset 12080 b8c4a8bab7b3
parent 12079 4870e5a60a52
child 12081 34dad81d955f
[devtools] Create "newcube" in current directory by default Instead of using "cubes path", which in many cases will be something wrong (like <prefix>/share/cubicweb/cubes) now that cubes are regular Python packages.
cubicweb/devtools/devctl.py
--- a/cubicweb/devtools/devctl.py	Mon Mar 20 14:39:22 2017 +0100
+++ b/cubicweb/devtools/devctl.py	Mon Mar 20 12:13:04 2017 +0100
@@ -28,7 +28,7 @@
 import tempfile
 import sys
 from datetime import datetime, date
-from os import mkdir, chdir, path as osp
+from os import getcwd, mkdir, chdir, path as osp
 import pkg_resources
 from warnings import warn
 
@@ -691,13 +691,8 @@
         verbose = self.get('verbose')
         destdir = self.get('directory')
         if not destdir:
-            cubespath = ServerConfiguration.cubes_search_path()
-            if len(cubespath) > 1:
-                raise BadCommandUsage(
-                    "can't guess directory where to put the new cube."
-                    " Please specify it using the --directory option")
-            destdir = cubespath[0]
-        if not osp.isdir(destdir):
+            destdir = getcwd()
+        elif not osp.isdir(destdir):
             print("-> creating cubes directory", destdir)
             try:
                 mkdir(destdir)