forked from ilius/pyglossary
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
executable file
·124 lines (109 loc) · 3.4 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#!/usr/bin/env python2
try:
import py2exe
except ImportError:
py2exe = None
import glob, os, sys
from os.path import join, dirname
from distutils.core import setup
from distutils.command.install import install
from pyglossary.glossary import VERSION
relRootDir = 'share/pyglossary'
class my_install(install):
def run(self):
install.run(self)
if os.sep == '/':
binPath = join(self.install_scripts, 'pyglossary')
print 'creating script file "%s"'%binPath
open(binPath, 'w').write(join(self.install_data, relRootDir, 'pyglossary.pyw'))
os.chmod(binPath, 0755)
data_files = [
(relRootDir, [
'about',
'license',
'help',
'pyglossary.pyw',
'AUTHORS',
]),
(relRootDir+'/ui', glob.glob('ui/*.py')),
(relRootDir+'/ui/glade', glob.glob('ui/glade/*')),
(relRootDir+'/res', glob.glob('res/*')),
('share/doc/pyglossary', []),
('share/doc/pyglossary/non-gui_examples', glob.glob('doc/non-gui_examples/*')),
('share/doc/pyglossary/Babylon', glob.glob('doc/Babylon/*')),
('share/doc/pyglossary/DSL', glob.glob('doc/DSL/*')),
('share/doc/pyglossary/Octopus MDict', glob.glob('doc/Octopus MDict/*')),
('share/applications', ['pyglossary.desktop']),
('share/pixmaps', ['res/pyglossary.png']),
]
def files(folder):
for path in glob.glob(folder+'/*'):
if os.path.isfile(path):
yield path
if py2exe:
py2exeoptions = {
'script_args': ['py2exe'],
'bundle_files': 1,
'windows': [
{
'script': 'pyglossary.pyw',
'icon_resources': [
(1, 'res/pyglossary.ico'),
],
},
],
'zipfile': None,
'options': {
'py2exe': {
'packages': [
'pyglossary',
'ui.ui_tk',
#'ui.ui_gtk',
#'BeautifulSoup',
#'xml',
'Tkinter', 'tkFileDialog', 'Tix',
#'gtk', 'glib', 'gobject',
],
},
},
}
data_files = [
('tcl/tix8.1', files(join(sys.prefix, 'tcl', 'tix8.4.3'))),
('tcl/tix8.1/bitmaps', files(join(sys.prefix, 'tcl', 'tix8.4.3', 'bitmaps'))),
('tcl/tix8.1/pref', files(join(sys.prefix, 'tcl', 'tix8.4.3', 'pref'))),
('tcl/tcl8.1/init.tcl', [join(sys.prefix, 'tcl', 'tix8.4.3', 'init.tcl')]),
('', ['about', 'license', 'help']),
('ui', glob.glob('ui/*.py')),
('ui/glade', glob.glob('ui/glade/*')),
('res', glob.glob('res/*')),
('plugins', glob.glob('pyglossary/plugins/*')),
('doc/pyglossary', ['doc/bgl_structure.svgz', ]),
('doc/pyglossary/non-gui_examples', glob.glob('doc/non-gui_examples/*')),
]
else:
py2exeoptions = {}
setup(
name = 'pyglossary',
version = VERSION,
cmdclass = {
'install': my_install,
},
description = 'A tool for workig with dictionary databases',
author = 'Saeed Rasooli',
author_email = '[email protected]',
license = 'GPLv3',
url = 'https://github.com/ilius/pyglossary',
scripts = [
#'pyglossary.pyw',
],
packages = [
'pyglossary',
],
package_data = {
'pyglossary': [
'plugins/*.py',
],
},
data_files = data_files,
**py2exeoptions
)