Save auto version number
Fixes #108
parent
6529fdbdd8
commit
aab85275c6
|
@ -19,5 +19,7 @@
|
||||||
|
|
||||||
# pylint: disable=unused-import,unused-variable
|
# pylint: disable=unused-import,unused-variable
|
||||||
|
|
||||||
|
__version__ = ""
|
||||||
|
|
||||||
from .morss import *
|
from .morss import *
|
||||||
from .wsgi import application
|
from .wsgi import application
|
||||||
|
|
23
setup.py
23
setup.py
|
@ -3,11 +3,32 @@ from glob import glob
|
||||||
|
|
||||||
from setuptools import setup
|
from setuptools import setup
|
||||||
|
|
||||||
|
def get_version():
|
||||||
|
with open('morss/__init__.py', 'r+') as file:
|
||||||
|
lines = file.readlines()
|
||||||
|
|
||||||
|
# look for hard coded version number
|
||||||
|
for i in range(len(lines)):
|
||||||
|
if lines[i].startswith('__version__'):
|
||||||
|
version = lines[i].split('"')[1]
|
||||||
|
break
|
||||||
|
|
||||||
|
# create (& save) one if none found
|
||||||
|
if version == '':
|
||||||
|
version = datetime.now().strftime('%Y%m%d.%H%M')
|
||||||
|
lines[i] = '__version__ = "' + version + '"\n'
|
||||||
|
|
||||||
|
file.seek(0)
|
||||||
|
file.writelines(lines)
|
||||||
|
|
||||||
|
# return version number
|
||||||
|
return version
|
||||||
|
|
||||||
package_name = 'morss'
|
package_name = 'morss'
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name = package_name,
|
name = package_name,
|
||||||
version = datetime.now().strftime('%Y%m%d.%H%M'),
|
version = get_version(),
|
||||||
description = 'Get full-text RSS feeds',
|
description = 'Get full-text RSS feeds',
|
||||||
long_description = open('README.md').read(),
|
long_description = open('README.md').read(),
|
||||||
long_description_content_type = 'text/markdown',
|
long_description_content_type = 'text/markdown',
|
||||||
|
|
Loading…
Reference in New Issue