read version from lib

master
François Boulogne 4 months ago
parent b7a655447a
commit 73a7aa353c

@ -0,0 +1 @@
__version__ == '0.1.2'

@ -1,20 +1,29 @@
import os
import re
from setuptools import setup, find_packages from setuptools import setup, find_packages
from os import path
# Function to read the requirements from the requirements.txt file def read_version(name):
with open(os.path.join(os.path.dirname(__file__), name, '__init__.py')) as f:
for line in f:
match = re.match(r"^__version__ = ['\"]([^'\"]*)['\"]", line)
if match:
return match.group(1)
raise RuntimeError("Unable to find version string.")
def parse_requirements(filename): def parse_requirements(filename):
with open(filename, 'r') as file: with open(filename, 'r') as file:
return file.read().splitlines() return file.read().splitlines()
# Get the long description from the README file # Get the long description from the README file
here = path.abspath(path.dirname(__file__)) here = os.path.abspath(os.path.dirname(__file__))
with open(path.join(here, 'README.md'), encoding='utf-8') as f: with open(os.path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read() long_description = f.read()
setup( setup(
name='labsw', name='labsw',
version='0.1.0', # Required version = read_version('labsw'),
description='A short description of the project', # Optional description='A short description of the project', # Optional
long_description=long_description, # Optional long_description=long_description, # Optional
long_description_content_type='text/markdown', # Optional (see note above) long_description_content_type='text/markdown', # Optional (see note above)

Loading…
Cancel
Save