read version from lib
This commit is contained in:
parent
b7a655447a
commit
73a7aa353c
2 changed files with 16 additions and 6 deletions
|
@ -0,0 +1 @@
|
|||
__version__ == '0.1.2'
|
21
setup.py
21
setup.py
|
@ -1,20 +1,29 @@
|
|||
|
||||
import os
|
||||
import re
|
||||
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):
|
||||
with open(filename, 'r') as file:
|
||||
return file.read().splitlines()
|
||||
|
||||
# Get the long description from the README file
|
||||
here = path.abspath(path.dirname(__file__))
|
||||
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
|
||||
long_description = f.read()
|
||||
here = os.path.abspath(os.path.dirname(__file__))
|
||||
with open(os.path.join(here, 'README.md'), encoding='utf-8') as f:
|
||||
long_description = f.read()
|
||||
|
||||
|
||||
setup(
|
||||
name='labsw',
|
||||
version='0.1.0', # Required
|
||||
version = read_version('labsw'),
|
||||
description='A short description of the project', # Optional
|
||||
long_description=long_description, # Optional
|
||||
long_description_content_type='text/markdown', # Optional (see note above)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue