forked from web2py/web2py
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup_app.py
executable file
·56 lines (49 loc) · 1.61 KB
/
setup_app.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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This is a setup.py script generated by py2applet
Usage:
python setup.py py2app
"""
from setuptools import setup
from gluon.import_all import base_modules, contributed_modules
import os
import fnmatch
class reglob:
def __init__(self, directory, pattern="*"):
self.stack = [directory]
self.pattern = pattern
self.files = []
self.index = 0
def __getitem__(self, index):
while 1:
try:
file = self.files[self.index]
self.index = self.index + 1
except IndexError:
self.index = 0
self.directory = self.stack.pop()
self.files = os.listdir(self.directory)
else:
fullname = os.path.join(self.directory, file)
if os.path.isdir(fullname) and not os.path.islink(fullname):
self.stack.append(fullname)
if not (file.startswith('.') or file.startswith('#') or file.endswith('~')) \
and fnmatch.fnmatch(file, self.pattern):
return fullname
setup(app=['web2py.py'],
data_files=[
'NEWINSTALL',
'ABOUT',
'LICENSE',
'VERSION',
] +
[x for x in reglob('applications/examples')] +
[x for x in reglob('applications/welcome')] +
[x for x in reglob('applications/admin')],
options={'py2app': {
'argv_emulation': True,
'includes': base_modules,
'packages': contributed_modules,
}},
setup_requires=['py2app'])