deploy-ng: allow using setup.cfg instead of setup.py

This commit is contained in:
rdb 2017-11-22 20:57:03 +01:00
parent 80b6021d22
commit 82ced9900e

View File

@ -65,6 +65,36 @@ class build_apps(distutils.core.Command):
return zip return zip
def finalize_options(self): def finalize_options(self):
# We need to massage the inputs a bit in case they came from a
# setup.cfg file.
def _parse_list(input):
if isinstance(input, basestring):
input = input.strip().replace(',', '\n')
if input:
return [item.strip() for item in input.split('\n') if item.strip()]
else:
return []
else:
return input
def _parse_dict(input):
if isinstance(input, dict):
return input
d = {}
for item in _parse_list(input):
key, sep, value = item.partition('=')
d[key.strip()] = value.strip()
return d
self.gui_apps = _parse_dict(self.gui_apps)
self.console_apps = _parse_dict(self.console_apps)
self.copy_paths = _parse_list(self.copy_paths)
self.exclude_paths = _parse_list(self.exclude_paths)
self.exclude_modules = _parse_list(self.include_modules)
self.exclude_modules = _parse_list(self.exclude_modules)
self.plugins = _parse_list(self.plugins)
for path in self.copy_paths: for path in self.copy_paths:
if isinstance(path, basestring): if isinstance(path, basestring):
src = path src = path
@ -78,6 +108,9 @@ class build_apps(distutils.core.Command):
if not self.deploy_platforms: if not self.deploy_platforms:
platforms = [p3d.PandaSystem.get_platform()] platforms = [p3d.PandaSystem.get_platform()]
use_wheels = False use_wheels = False
elif isinstance(self.deploy_platforms, basestring):
platforms = [self.deploy_platforms]
use_wheels = True
else: else:
platforms = self.deploy_platforms platforms = self.deploy_platforms
use_wheels = True use_wheels = True