-
Notifications
You must be signed in to change notification settings - Fork 6
/
setup.py
executable file
·73 lines (63 loc) · 1.85 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2006-2007, TUBITAK/UEKAE
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version. Please read the COPYING file.
#
import os
import sys
import glob
import shutil
from distutils.core import setup
from distutils.command.install import install
from comar import __version__ as version
distfiles = """
setup.py
comar/*.py
"""
def make_dist():
distdir = "comar-api-%s" % version
list = []
for t in distfiles.split():
list.extend(glob.glob(t))
if os.path.exists(distdir):
shutil.rmtree(distdir)
os.mkdir(distdir)
for file_ in list:
cum = distdir[:]
for d in os.path.dirname(file_).split('/'):
dn = os.path.join(cum, d)
cum = dn[:]
if not os.path.exists(dn):
os.mkdir(dn)
shutil.copy(file_, os.path.join(distdir, file_))
os.popen("tar -czf %s %s" % ("comar-api-" + version + ".tar.gz", distdir))
shutil.rmtree(distdir)
if "dist" in sys.argv:
make_dist()
sys.exit(0)
class Install(install):
def finalize_options(self):
# NOTE: for Pardus distribution
if os.path.exists("/etc/pisilinux-release"):
self.install_platlib = '$base/lib/pisilinux'
self.install_purelib = '$base/lib/pisilinux'
install.finalize_options(self)
def run(self):
install.run(self)
setup(
name = 'comar',
version = version,
description = 'COMAR API Functions',
url = 'http://www.pardus.org.tr/projeler/comar',
license = 'GNU GPL2',
package_dir = { '': '' },
packages = [ 'comar' ],
cmdclass = {
'install' : Install
}
)