Browse Source

hardcode version into setup.py file

shut-new-model
Niklas Rosenstein 9 months ago
parent
commit
8f915fb7a9
No known key found for this signature in database GPG Key ID: 6D269B33D25F6C6
2 changed files with 3 additions and 14 deletions
  1. + 1
    - 5
      setup.py
  2. + 2
    - 9
      src/shut/update/setuptools.py

+ 1
- 5
setup.py

@ -4,13 +4,9 @@
from __future__ import print_function
import io
import os
import re
import setuptools
import sys
with io.open('src/shut/__init__.py', encoding='utf8') as fp:
version = re.search(r"__version__\s*=\s*'(.*)'", fp.read()).group(1)
readme_file = 'README.md'
if os.path.isfile(readme_file):
with io.open(readme_file, encoding='utf8') as fp:
@ -40,7 +36,7 @@ requirements = [
setuptools.setup(
name = 'shut',
version = version,
version = '0.1.0',
author = 'Niklas Rosenstein',
author_email = 'rosensteinniklas@gmail.com',
description = 'Automates the heavy lifting of release and distribution management for pure Python packages.',

+ 2
- 9
src/shut/update/setuptools.py

@ -88,7 +88,6 @@ class SetuptoolsRenderer(Renderer[PackageModel]):
fp.write(textwrap.dedent('''
import io
import os
import re
import setuptools
import sys
''').lstrip())
@ -139,13 +138,6 @@ class SetuptoolsRenderer(Renderer[PackageModel]):
'''))
cmdclass['develop'] = 'develop_command'
# Write the helper that extracts the version number from the entry file.
pkg_metadata_file = os.path.relpath(metadata.filename, package.get_directory())
fp.write(textwrap.dedent('''
with io.open({entrypoint_file!r}, encoding='utf8') as fp:
version = re.search(r"__version__\s*=\s*'(.*)'", fp.read()).group(1)
''').format(entrypoint_file=_normpath(pkg_metadata_file)))
readme_file, long_description_expr = self._render_readme_code(fp, package)
# Write the install requirements.
@ -192,7 +184,7 @@ class SetuptoolsRenderer(Renderer[PackageModel]):
fp.write(textwrap.dedent('''
setuptools.setup(
name = {name!r},
version = version,
version = {version!r},
author = {author_name!r},
author_email = {author_email!r},
description = {description!r},
@ -214,6 +206,7 @@ class SetuptoolsRenderer(Renderer[PackageModel]):
classifiers = {classifiers!r},
''').rstrip().format(
name=data.name,
version=str(data.version),
packages_args=packages_args,
author_name=data.author.name,
author_email=data.author.email,

Loading…
Cancel
Save