[pkg] Replace custom "scripts" handling by a setuptools entry points
authorDenis Laxalde <denis.laxalde@logilab.fr>
Wed, 24 Jan 2018 11:40:12 +0100
changeset 12254 2060ee44ea9a
parent 12253 9165f4b7426b
child 12255 08628d6d57ee
[pkg] Replace custom "scripts" handling by a setuptools entry points http://setuptools.readthedocs.io/en/latest/setuptools.html#automatic-script-creation
cubicweb/__pkginfo__.py
setup.py
--- a/cubicweb/__pkginfo__.py	Wed Jan 24 13:30:50 2018 +0100
+++ b/cubicweb/__pkginfo__.py	Wed Jan 24 11:40:12 2018 +0100
@@ -43,10 +43,6 @@
     'Programming Language :: JavaScript',
 ]
 
-scripts = [s for s in glob.glob(join('bin', 'cubicweb-*'))
-           if not s.endswith('.bat')]
-
-
 _server_migration_dir = join(modname, 'misc', 'migration')
 _data_dir = join(modname, 'web', 'data')
 _wdoc_dir = join(modname, 'web', 'wdoc')
--- a/setup.py	Wed Jan 24 13:30:50 2018 +0100
+++ b/setup.py	Wed Jan 24 11:40:12 2018 +0100
@@ -49,24 +49,10 @@
 
 # import optional features
 distname = __pkginfo__['distname']
-scripts = __pkginfo__['scripts']
 data_files = __pkginfo__['data_files']
 package_data = __pkginfo__['package_data']
 
 
-def ensure_scripts(linux_scripts):
-    """
-    Creates the proper script names required for each platform
-    (taken from 4Suite)
-    """
-    from distutils import util
-    if util.get_platform()[:3] == 'win':
-        scripts_ = [script + '.bat' for script in linux_scripts]
-    else:
-        scripts_ = linux_scripts
-    return scripts_
-
-
 def get_packages(directory, prefix):
     """return a list of subpackages for the given directory
     """
@@ -123,7 +109,6 @@
     author_email=author_email,
     packages=[modname] + get_packages(join(here, modname), modname),
     package_data=package_data,
-    scripts=ensure_scripts(scripts),
     data_files=data_files,
     include_package_data=True,
     install_requires=[
@@ -140,6 +125,9 @@
         'unittest2 >= 0.7.0',
     ],
     entry_points={
+        'console_scripts': [
+            'cubicweb-ctl = cubicweb.cwctl:run',
+        ],
         'paste.app_factory': [
             'pyramid_main=cubicweb.pyramid:pyramid_app',
         ],