Save auto version number
default / test-lint (push) Successful in 1m31s Details
default / python-publish (push) Successful in 35s Details
default / docker-publish-deploy (push) Successful in 1m56s Details

Fixed #108
master
pictuga 2023-06-27 22:36:29 +02:00
parent 6529fdbdd8
commit c5b2df754e
2 changed files with 25 additions and 1 deletions

View File

@ -19,5 +19,7 @@
# pylint: disable=unused-import,unused-variable
__version__ = ""
from .morss import *
from .wsgi import application

View File

@ -3,11 +3,33 @@ from glob import glob
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'
setup(
name = package_name,
version = datetime.now().strftime('%Y%m%d.%H%M'),
version = get_version(),
description = 'Get full-text RSS feeds',
long_description = open('README.md').read(),
long_description_content_type = 'text/markdown',