From 5424d8bb8870e7a6521ada5fb182057f566723ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Wed, 12 Sep 2018 10:29:40 +0200 Subject: [PATCH] add application skeleton --- MANIFEST.in | 3 +++ grandlyon_elyx/__init__.py | 0 setup.py | 45 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 MANIFEST.in create mode 100644 grandlyon_elyx/__init__.py create mode 100644 setup.py diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..1922595 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,3 @@ +include README +include MANIFEST.in +include VERSION diff --git a/grandlyon_elyx/__init__.py b/grandlyon_elyx/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..63f9b7d --- /dev/null +++ b/setup.py @@ -0,0 +1,45 @@ +#! /usr/bin/env python + +import os +import subprocess + +from setuptools import setup, find_packages +from distutils.command.sdist import sdist + +class eo_sdist(sdist): + def run(self): + if os.path.exists('VERSION'): + os.remove('VERSION') + version = get_version() + version_file = open('VERSION', 'w') + version_file.write(version) + version_file.close() + sdist.run(self) + if os.path.exists('VERSION'): + os.remove('VERSION') + +def get_version(): + if os.path.exists('VERSION'): + version_file = open('VERSION', 'r') + version = version_file.read() + version_file.close() + return version + if os.path.exists('.git'): + p = subprocess.Popen(['git', 'describe', '--dirty', '--match=v*'], stdout=subprocess.PIPE) + result = p.communicate()[0] + if p.returncode == 0: + version = result.split()[0][1:] + version = version.replace('-', '.') + return version + return '0' + + +setup( + name='passerelle-grandlyon-elyx', + version=get_version(), + author='Grand Lyon', + packages=find_packages(), + cmdclass={ + 'sdist': eo_sdist, + } +)