Update "setup.py" file generation.
@@ -373,6 +373,38 @@ def build(ctx):
ctx.run('rm -rf {0}-{1}'.format(PYPI_PACKAGE_NAME,
APPLICATION_VERSION))
+ with open('setup.py') as setup_file:
+ source = setup_file.read()
+
+ setup_kwargs = []
+
+ def sub_callable(match):
+ setup_kwargs.append(match)
+
+ return ''
+
+ template = """
+setup({0}
+)
+"""
+
+ source = re.sub(
+ 'setup_kwargs = {(.*)}.*setup\\(\\*\\*setup_kwargs\\)',
+ sub_callable,
+ source,
+ flags=re.DOTALL)[:-2]
+ setup_kwargs = setup_kwargs[0].group(1).splitlines()
+ for i, line in enumerate(setup_kwargs):
+ setup_kwargs[i] = re.sub('^\\s*(\'(\\w+)\':\\s?)', ' \\2=', line)
+ if setup_kwargs[i].strip().startswith('long_description'):
+ setup_kwargs[i] = (
+ ' long_description=open(\'README.rst\').read(),')
+
+ source += template.format('\n'.join(setup_kwargs))
+
+ with open('setup.py', 'w') as setup_file:
+ setup_file.write(source)
+
@task(clean, build)
def virtualise(ctx, tests=True):
