From 248a15c0bb9963f95a368c19db266a198766af15 Mon Sep 17 00:00:00 2001 From: Jan Mach <jan.mach@cesnet.cz> Date: Thu, 7 Sep 2017 12:21:08 +0200 Subject: [PATCH] Changed the setup.py script to include and use the actual package version directly from Python module in local directory. This change really simplifies package versioning, because value of only one __version__ variable needs to be updated and it will be used as version identifier of generated Python packages (wheels). Previous commit, that introduced automated package documentation already used this approach. --- setup.py | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/setup.py b/setup.py index a34b822..a3a333c 100644 --- a/setup.py +++ b/setup.py @@ -1,9 +1,10 @@ #!/usr/bin/python3 # -*- coding: utf-8 -*- #------------------------------------------------------------------------------- +# This file is part of typedcols package (https://pypi.python.org/pypi/typedcols). +# # Copyright (c) since 2016, CESNET, z. s. p. o. -# Authors: Pavel Kácha <pavel.kacha@cesnet.cz> -# Jan Mach <jan.mach@cesnet.cz> +# Author: Pavel Kácha <pavel.kacha@cesnet.cz> # Use of this source is governed by an ISC license, see LICENSE file. #------------------------------------------------------------------------------- @@ -11,21 +12,32 @@ # https://packaging.python.org/en/latest/ # http://python-packaging-user-guide.readthedocs.io/distributing/ +import sys +import os + # Always prefer setuptools over distutils from setuptools import setup, find_packages # To use a consistent encoding from codecs import open -from os import path -here = path.abspath(path.dirname(__file__)) +# +# Import local version of typedcols library, so that we can insert correct version +# number into documentation. +# +sys.path.insert(0, os.path.abspath('.')) +import typedcols + +#------------------------------------------------------------------------------- + +here = os.path.abspath(os.path.dirname(__file__)) # Get the long description from the README file -with open(path.join(here, 'README.rst'), encoding='utf-8') as f: +with open(os.path.join(here, 'README.rst'), encoding='utf-8') as f: long_description = f.read() setup( name = 'typedcols', - version = '0.1.7', + version = typedcols.__version__, description = 'Python library providing typed collections.', long_description = long_description, classifiers = [ @@ -34,7 +46,7 @@ setup( 'Programming Language :: Python', ], keywords = 'library', - url = 'https://homeproj.cesnet.cz/git/idea.git', + url = 'https://homeproj.cesnet.cz/git/typedcols.git', author = 'Pavel Kacha', author_email = 'pavel.kacha@cesnet.cz', license = 'ISC', -- GitLab