forked from fumail/postomaat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
56 lines (47 loc) · 1.65 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
from distutils.core import setup
import glob
import sys
sys.path.insert(0,'src')
import os
#store old content of version file here
#if we have git available, temporarily overwrite the file
#so we can report the git commit id in fuglu --version
OLD_VERSFILE_CONTENT=None
VERSFILE='src/postomaat/__init__.py'
def git_version():
from postomaat import POSTOMAAT_VERSION
global VERSFILE,OLD_VERSFILE_CONTENT
try:
import subprocess
x=subprocess.Popen(['git','describe'],stdout=subprocess.PIPE,stderr=subprocess.PIPE)
ret=x.wait()
if ret==0:
stdout,stderr=x.communicate()
vers=stdout.strip()
if os.path.isfile(VERSFILE):
OLD_VERSFILE_CONTENT=open(VERSFILE,'r').read()
buff=OLD_VERSFILE_CONTENT.replace(POSTOMAAT_VERSION,vers)
open(VERSFILE,'w').write(buff)
return vers
else:
return POSTOMAAT_VERSION
except Exception:
return POSTOMAAT_VERSION
setup(name = "postomaat",
version = git_version(),
description = "Postomaat Policy Daemon",
author = "O. Schacher",
url='http://www.wgwh.ch',
author_email = "[email protected]",
package_dir={'':'src'},
packages = ['postomaat','postomaat.plugins','postomaat.extensions'],
scripts = ["src/startscript/postomaat","src/tools/postomaat_conf"],
long_description = """0""" ,
data_files=[
('/etc/postomaat',glob.glob('conf/*.dist')),
('/etc/postomaat/conf.d',glob.glob('conf/conf.d/*.dist')),
]
)
#cleanup
if OLD_VERSFILE_CONTENT!=None:
open(VERSFILE,'w').write(OLD_VERSFILE_CONTENT)