Improvements in setup.py

Thu, 16 Feb 2017 12:21:52 +0200

author
Iannis <ulalume3@yahoo.com>
date
Thu, 16 Feb 2017 12:21:52 +0200
changeset 53
cd7cffb43bfd
parent 52
fdf4373db30e
child 54
357138ffbeaf

Improvements in setup.py

setup.py file | annotate | diff | comparison | revisions
--- a/setup.py	Thu Feb 16 10:27:30 2017 +0200
+++ b/setup.py	Thu Feb 16 12:21:52 2017 +0200
@@ -1,19 +1,52 @@
 #!/usr/bin/env python
 
 from setuptools import setup
+import os
+import re
+import io
 
-# Read the long description from the readmef ile
+# Read the long description from the readme file
 with open("readme.rst", "rb") as f:
     long_descr = f.read().decode("utf-8")
 
+
+# Read the version parameters from the __init__.py file. In this way
+# we keep the version information in a single place.
+def read(*names, **kwargs):
+    with io.open(
+            os.path.join(os.path.dirname(__file__), *names),
+            encoding=kwargs.get("encoding", "utf8")
+    ) as fp:
+        return fp.read()
+
+
+def find_version(*file_paths):
+    version_file = read(*file_paths)
+    version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]",
+                              version_file, re.M)
+    if version_match:
+        return version_match.group(1)
+    raise RuntimeError("Unable to find version string.")
+
+
 # Run setup
 setup(name='atmospheric_lidar_reader',
       packages=['atmospheric_lidar', 'atmospheric_lidar.scripts'],
-      version='0.2.0',
+      version=find_version("atmospheric_lidar", "__init__.py"),
       description='Classes for reading raw atmospheric lidar data.',
       long_description=long_descr,
+      url='https://bitbucket.org/iannis_b/atmospheric-lidar/',
       author='Ioannis Binietoglou',
       author_email='ioannis@inoe.ro',
+      license='MIT',
+      classifiers=[
+          'Development Status :: 3 - Alpha',
+          'License :: OSI Approved :: MIT License',
+          'Programming Language :: Python :: 2',
+          'Intended Audience :: Science/Research',
+          'Topic :: Scientific/Engineering :: Atmospheric Science',
+      ],
+      keywords='lidar aerosol licel SCC',
       install_requires=[
           "numpy",
           "matplotlib",

mercurial