Save auto version number
default / test-lint (push) Failing after 37s Details
default / docker-publish-deploy (push) Has been cancelled Details
default / python-publish (push) Has been cancelled Details

Fixes #108
pictuga 2023-06-27 22:30:25 +02:00
parent 6529fdbdd8
commit aab85275c6
2 changed files with 24 additions and 1 deletions

View File

@ -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

View File

@ -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',