Move version string to the python code
This way the python module "knows" its own version. To avoid duplication, read the value back from setup.py. The reader function only needs to support the specific format used in the code, so it can be very simplistic.
This commit is contained in:
parent
8d21ef1ee4
commit
aa9fc8646a
2 changed files with 12 additions and 1 deletions
|
@ -1,2 +1,4 @@
|
|||
from .metadata import *
|
||||
from . import licensing
|
||||
|
||||
__version__ = '9'
|
||||
|
|
11
setup.py
11
setup.py
|
@ -1,8 +1,17 @@
|
|||
from setuptools import setup
|
||||
|
||||
def read_version(path):
|
||||
with open(path, 'rt') as f:
|
||||
for line in f:
|
||||
if line.startswith('__version__'):
|
||||
return line.split("'")[1]
|
||||
raise IOError
|
||||
|
||||
version = read_version('rust2rpm/__init__.py')
|
||||
|
||||
ARGS = dict(
|
||||
name="rust2rpm",
|
||||
version="9",
|
||||
version=version,
|
||||
description="Convert Rust crates to RPM",
|
||||
license="MIT",
|
||||
keywords="rust cargo rpm",
|
||||
|
|
Loading…
Reference in a new issue