tiramisu/setup.py

54 lines
1.7 KiB
Python
Raw Normal View History

2012-07-13 11:22:00 +02:00
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from distutils.core import setup
2013-08-29 16:38:23 +02:00
from os.path import dirname, abspath, join, normpath, isdir, basename
from os import listdir
2012-07-13 11:22:00 +02:00
import os
import subprocess
def fetch_version():
"""Get version from version.in or latest git tag"""
version_file='version.in'
2013-08-29 12:15:12 +02:00
version = "1.0"
git_last_tag_cmd = ['git', 'describe', '--tags', '--abbrev=0']
try:
if os.path.isfile(version_file):
version=file(version_file).readline().strip()
elif os.path.isdir('.git'):
popen = subprocess.Popen(git_last_tag_cmd, stdout=subprocess.PIPE)
out, ret = popen.communicate()
for line in out.split('\n'):
if line:
version = line.lstrip('release/')
break
except OSError:
pass # Failing is fine, we just can't print the version then
return version
2013-08-29 16:38:23 +02:00
def return_storages():
"returns all the storage plugins that are living in tiramisu/storage"
here = dirname(abspath(__file__))
storages_path = normpath(join(here, 'tiramisu', 'storage'))
dir_content = [ content for content in listdir(storages_path) \
if not content =='__pycache__']
storages = filter(isdir, [join(storages_path, content) \
for content in dir_content])
storage_list = [basename(storage) for storage in storages]
return storage_list
packages = ['tiramisu', 'tiramisu.storage']
packages.extend(return_storages())
2012-07-13 11:22:00 +02:00
setup(
2013-08-29 12:15:12 +02:00
author='cadoles team',
author_email='contact@cadoles.com',
2012-07-13 11:22:00 +02:00
name='tiramisu',
version=fetch_version(),
2012-07-13 11:22:00 +02:00
description='configuration management tool',
url='http://labs.libre-entreprise.org/projects/tiramisu',
2013-08-29 16:38:23 +02:00
packages=packages
2012-07-13 11:22:00 +02:00
)