Lines 290-299
Link Here
|
290 |
|
290 |
|
291 |
########################################################################### |
291 |
########################################################################### |
292 |
class InstallApplicationDataAndLinks(install_data): |
292 |
class InstallApplicationDataAndLinks(install_data): |
|
|
293 |
user_options = [ |
294 |
('compile', 'c', "compile .py to .pyc [default]"), |
295 |
('no-compile', None, "don't compile .py files"), |
296 |
] |
297 |
|
298 |
boolean_options = ['compile'] |
299 |
negative_opt = {'no-compile': 'compile'} |
300 |
|
293 |
def get_command_name(self): |
301 |
def get_command_name(self): |
294 |
return 'install_application_data' |
302 |
return 'install_application_data' |
295 |
|
303 |
|
296 |
def initialize_options(self): |
304 |
def initialize_options(self): |
|
|
305 |
self.compile = None |
297 |
install_data.initialize_options(self) |
306 |
install_data.initialize_options(self) |
298 |
|
307 |
|
299 |
self.data_files = self.distribution.application_data |
308 |
self.data_files = self.distribution.application_data |
Lines 303-310
Link Here
|
303 |
('install_application_data', 'install_dir'), |
312 |
('install_application_data', 'install_dir'), |
304 |
('root', 'root'), |
313 |
('root', 'root'), |
305 |
('force', 'force'), |
314 |
('force', 'force'), |
|
|
315 |
('compile', 'compile'), |
306 |
) |
316 |
) |
307 |
|
317 |
|
|
|
318 |
if self.compile is None: |
319 |
self.compile = 1 |
320 |
|
308 |
def run(self): |
321 |
def run(self): |
309 |
self.outfiles.extend(self.mkpath(self.install_dir)) |
322 |
self.outfiles.extend(self.mkpath(self.install_dir)) |
310 |
for f in self.data_files: |
323 |
for f in self.data_files: |
Lines 366-375
Link Here
|
366 |
|
379 |
|
367 |
# Byte compile the .py files |
380 |
# Byte compile the .py files |
368 |
from distutils.util import byte_compile |
381 |
from distutils.util import byte_compile |
369 |
byte_compile(self.outfiles, optimize=0, force=1, prefix=prefix, base_dir=install_cmd.prefix, dry_run=self.dry_run) |
382 |
if self.compile: |
|
|
383 |
byte_compile(self.outfiles, optimize=0, force=1, prefix=prefix, base_dir=install_cmd.prefix, dry_run=self.dry_run) |
370 |
|
384 |
|
371 |
# Add the .pyc files to the list of outfiles. |
385 |
# Add the .pyc files to the list of outfiles. |
372 |
self.outfiles.extend( [item+'c' for item in self.outfiles if item.endswith('.py')] ) |
386 |
self.outfiles.extend( [item+'c' for item in self.outfiles if item.endswith('.py')] ) |
373 |
|
387 |
|
374 |
def mkpath(self, name, mode=0777): |
388 |
def mkpath(self, name, mode=0777): |
375 |
return dir_util.mkpath(name, mode, dry_run=self.dry_run) |
389 |
return dir_util.mkpath(name, mode, dry_run=self.dry_run) |