@@ -40,7 +40,7 @@ def include(d, e):
40
40
41
41
'e' -- A glob pattern"""
42
42
43
- return (d , [f for f in glob ('%s/%s' % (d , e )) if os .path .isfile (f )])
43
+ return (d , [f for f in glob ('%s/%s' % (d , e )) if os .path .isfile (f )])
44
44
45
45
46
46
def mapscript (path ):
@@ -51,6 +51,7 @@ def mapscript(path):
51
51
script = module .replace ('_' , '-' )
52
52
return '%s = roundup.scripts.%s:run' % (script , module )
53
53
54
+
54
55
def make_data_files_absolute (data_files , prefix ):
55
56
"""Using setuptools data files are put under the egg install directory
56
57
if the datafiles are relative paths. We don't want this. Data files
@@ -65,51 +66,51 @@ def make_data_files_absolute(data_files, prefix):
65
66
66
67
return new_data_files
67
68
69
+
68
70
def get_prefix ():
69
71
"""Get site specific prefix using --prefix, platform lib or
70
72
sys.prefix.
71
73
"""
72
- prefix_arg = False
73
- prefix = ""
74
+ prefix_arg = False
75
+ prefix = ""
74
76
for a in sys .argv :
75
77
if prefix_arg :
76
- prefix = a
78
+ prefix = a
77
79
break
78
80
# is there a short form -p or something for this??
79
81
if a .startswith ('--prefix' ):
80
82
if a == '--prefix' :
81
83
# next argument is prefix
82
- prefix_arg = True
84
+ prefix_arg = True
83
85
continue
84
- else :
85
- # strip '--prefix='
86
- prefix = a [9 :]
86
+ # strip '--prefix='
87
+ prefix = a [9 :]
87
88
if prefix :
88
89
return prefix
89
- else :
90
- if sys .platform .startswith ('win' ):
91
- # on windows, using pip to install and
92
- # prefixing data file paths with c:\path\a\b\...
93
- # results in treatment as a relative path.
94
- # The result is files are buried under:
95
- # platlib\path\a\b\...\share\ and not findable by
96
- # Roundup. So return no prefix which places the files at
97
- # platlib\share\{doc,locale,roundup} where roundup can
98
- # find templates/translations etc.
99
- # sigh....
100
- return ""
101
-
102
- # start with the platform library
103
- plp = get_path ('platlib' )
104
- # nuke suffix that matches lib/* and return prefix
105
- head , tail = os .path .split (plp )
106
- old_head = None
107
- while tail .lower () not in ['lib' , 'lib64' ] and head != old_head :
108
- old_head = head
109
- head , tail = os .path .split (head )
110
- if head == old_head :
111
- head = sys .prefix
112
- return head
90
+
91
+ if sys .platform .startswith ('win' ):
92
+ # on windows, using pip to install and
93
+ # prefixing data file paths with c:\path\a\b\...
94
+ # results in treatment as a relative path.
95
+ # The result is files are buried under:
96
+ # platlib\path\a\b\...\share\ and not findable by
97
+ # Roundup. So return no prefix which places the files at
98
+ # platlib\share\{doc,locale,roundup} where roundup can
99
+ # find templates/translations etc.
100
+ # sigh....
101
+ return ""
102
+
103
+ # start with the platform library
104
+ plp = get_path ('platlib' )
105
+ # nuke suffix that matches lib/* and return prefix
106
+ head , tail = os .path .split (plp )
107
+ old_head = None
108
+ while tail .lower () not in ['lib' , 'lib64' ] and head != old_head :
109
+ old_head = head
110
+ head , tail = os .path .split (head )
111
+ if head == old_head :
112
+ head = sys .prefix
113
+ return head
113
114
114
115
115
116
def main ():
@@ -132,17 +133,17 @@ def main():
132
133
133
134
# build list of zope files/directories
134
135
Zope = {}
135
- Zope ['module' ] = [ f for f in glob ('frontends/ZRoundup/*.py' )]
136
- Zope ['module' ].append ('frontends/ZRoundup/refresh.txt' );
137
- Zope ['icons' ] = [ f for f in glob ('frontends/ZRoundupscripts/*.gif' )]
138
- Zope ['dtml' ] = [ f for f in glob ('frontends/ZRoundupscripts/*.dtml' )]
136
+ Zope ['module' ] = list ( glob ('frontends/ZRoundup/*.py' ))
137
+ Zope ['module' ].append ('frontends/ZRoundup/refresh.txt' )
138
+ Zope ['icons' ] = list ( glob ('frontends/ZRoundupscripts/*.gif' ))
139
+ Zope ['dtml' ] = list ( glob ('frontends/ZRoundupscripts/*.dtml' ))
139
140
140
141
data_files = [
141
142
('share/roundup/cgi-bin' , ['frontends/roundup.cgi' ]),
142
143
('share/roundup/frontends' , ['frontends/wsgi.py' ]),
143
144
('share/roundup/frontends/ZRoundup' , Zope ['module' ]),
144
145
('share/roundup/frontends/ZRoundup/icons' , Zope ['icons' ]),
145
- ('share/roundup/frontends/ZRoundup/dtml' , Zope ['dtml' ])
146
+ ('share/roundup/frontends/ZRoundup/dtml' , Zope ['dtml' ]),
146
147
]
147
148
# install man pages on POSIX platforms
148
149
if os .name == 'posix' :
@@ -191,7 +192,8 @@ def main():
191
192
# because the distutils installer will try to use the mbcs codec
192
193
# which isn't available on non-windows platforms. See also
193
194
# http://bugs.python.org/issue10945
194
- long_description = open ('doc/announcement.txt' ).read ()
195
+ with open ('doc/announcement.txt' ) as announcement :
196
+ long_description = announcement .read ()
195
197
try :
196
198
# attempt to interpret string as 'ascii'
197
199
long_description .encode ('ascii' )
@@ -252,7 +254,7 @@ def main():
252
254
extras_require = {
253
255
"charting" : ['pygal' ],
254
256
"jinja2" : ['jinja2' ],
255
- "extras" : [ 'brotli' , 'pytz' ],
257
+ "extras" : ['brotli' , 'pytz' ],
256
258
"test" : ['pytest > 7.0.0' ],
257
259
},
258
260
# Override certain command classes with our own ones
@@ -263,10 +265,11 @@ def main():
263
265
},
264
266
packages = packages ,
265
267
entry_points = {
266
- 'console_scripts' : scripts
268
+ 'console_scripts' : scripts ,
267
269
},
268
270
data_files = data_files )
269
271
272
+
270
273
if __name__ == '__main__' :
271
274
272
275
# Prevent `pip install roundup` from building bdist_wheel.
0 commit comments