-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
executable file
·104 lines (89 loc) · 3.69 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/usr/bin/env python
# PAPAS Access Point Administration System
# Copyright (c) 2010 Revolution Linux inc. <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Author : Vincent Vinet <[email protected]>
import sys, os, shutil, getopt, re
from distutils.core import setup, Extension
from distutils.command import build_py
from django.core.management.commands import compilemessages
#init_dir = '/etc/init.d'
etc_dir = '/etc/apmanager'
#lib_dir = '/var/lib'
data_files_list = []
#[(etc_dir, ['config/__init__.py', 'config/vsmanage_config.py'])]
def append_to_data_files(data_files_list, regexp, data_path, destination):
for root, dirs, files in os.walk(data_path):
# If the path does not contains ".svn"
if root.find(".svn") == -1:
# Keep only the files matching the regular expression
file_list = filter(regexp.search, files)
# Prepend the root path to each file in the list
file_list = map((lambda file: os.path.join(root, file)), file_list)
# Remove data_path from root
root = root[len(data_path):]
if len(root) >= 1 and root[0] == '/':
root = root[1:]
# Prepend the install path
root = os.path.join(destination, root)
# Associate this directory in the data_files_list
data_files_list.append((root, file_list))
append_to_data_files(data_files_list, re.compile(r".*"), 'apmanager/templates', '/usr/share/papas/templates')
append_to_data_files(data_files_list, re.compile(r"(?<!\.placeholder)$"), 'var', '/var/lib/papas/')
append_to_data_files(data_files_list, re.compile(r".*"), 'etc', '/etc')
append_to_data_files(data_files_list, re.compile(r".*"), 'locale', '/usr/share/papas/locale')
# print '!!!', data_files_list
# packages_list = []
# #Need to include files in MANIFEST.in for this to work
# packages_data = {}
# for (dirpath, dirnames, filenames) in os.walk("vsmanage"):
# if dirpath.find('.svn') != -1:
# # skip .svn directories
# continue
# package_name = dirpath.replace('/', '.')
# packages_list.append(package_name)
#
# packages_data[package_name] = ['*']
class CompileI18nBuildWrapper(build_py.build_py):
def run(self):
compilemessages.Command().execute()
build_py.build_py.run(self)
setup(
cmdclass={
'build_py': CompileI18nBuildWrapper,
},
name="papas",
version="1.1.0",
description="simple django app to manage wifi hotspots",
author="Revolution Linux",
author_email="[email protected]",
url="http://www.revolutionlinux.com",
license="AGPLv3",
platforms=["Linux"],
long_description="""Django Application To manage a group of Wifi Hotspots""",
scripts=['bin/apmanager-cmdexecutor'],
packages=[
"apmanager",
"apmanager.accesspoints",
"apmanager.accesspoints.views",
"apmanager.accesspoints.templatetags",
"lib6ko",
"lib6ko.protocols",
"lib6ko.templatetags",
"lib6ko.transports",
],
#package_data=
data_files = data_files_list,
)