Lines Matching refs:self

163     def initialize_options(self):
167 self.prefix = None
168 self.exec_prefix = None
169 self.home = None
170 self.user = 0
175 self.install_base = None
176 self.install_platbase = None
177 self.root = None
183 self.install_purelib = None # for pure module distributions
184 self.install_platlib = None # non-pure (dists w/ extensions)
185 self.install_headers = None # for C/C++ headers
186 self.install_lib = None # set to either purelib or platlib
187 self.install_scripts = None
188 self.install_data = None
190 self.install_userbase = USER_BASE
191 self.install_usersite = USER_SITE
193 self.compile = None
194 self.optimize = None
205 self.extra_path = None
206 self.install_path_file = 1
214 self.force = 0
215 self.skip_build = 0
216 self.warn_dir = 1
224 self.build_base = None
225 self.build_lib = None
229 #self.install_man = None
230 #self.install_html = None
231 #self.install_info = None
233 self.record = None
242 def finalize_options(self):
258 if ((self.prefix or self.exec_prefix or self.home) and
259 (self.install_base or self.install_platbase)):
264 if self.home and (self.prefix or self.exec_prefix):
268 if self.user and (self.prefix or self.exec_prefix or self.home or
269 self.install_base or self.install_platbase):
275 if self.exec_prefix:
276 self.warn("exec-prefix option ignored on this platform")
277 self.exec_prefix = None
287 self.dump_dirs("pre-finalize_{unix,other}")
290 self.finalize_unix()
292 self.finalize_other()
294 self.dump_dirs("post-finalize_{unix,other}()")
296 # Expand configuration variables, tilde, etc. in self.install_base
297 # and self.install_platbase -- that way, we can use $base or
308 self.config_vars = {'dist_name': self.distribution.get_name(),
309 'dist_version': self.distribution.get_version(),
310 'dist_fullname': self.distribution.get_fullname(),
323 self.config_vars['userbase'] = self.install_userbase
324 self.config_vars['usersite'] = self.install_usersite
327 self.config_vars['srcdir'] = sysconfig.get_config_var('srcdir')
329 self.expand_basedirs()
331 self.dump_dirs("post-expand_basedirs()")
335 self.config_vars['base'] = self.install_base
336 self.config_vars['platbase'] = self.install_platbase
341 pprint(self.config_vars)
345 self.expand_dirs()
347 self.dump_dirs("post-expand_dirs()")
350 if self.user:
351 self.create_home_path()
357 if self.install_lib is None:
358 if self.distribution.ext_modules: # has extensions: non-pure
359 self.install_lib = self.install_platlib
361 self.install_lib = self.install_purelib
366 self.convert_paths('lib', 'purelib', 'platlib',
369 self.convert_paths('userbase', 'usersite')
376 self.handle_extra_path()
377 self.install_libbase = self.install_lib # needed for .pth file
378 self.install_lib = os.path.join(self.install_lib, self.extra_dirs)
382 if self.root is not None:
383 self.change_roots('libbase', 'lib', 'purelib', 'platlib',
386 self.dump_dirs("after prepending root")
389 self.set_undefined_options('build',
396 def dump_dirs(self, msg):
402 for opt in self.user_options:
406 if opt_name in self.negative_opt:
407 opt_name = self.negative_opt[opt_name]
409 val = not getattr(self, opt_name)
412 val = getattr(self, opt_name)
415 def finalize_unix(self):
417 if self.install_base is not None or self.install_platbase is not None:
418 if ((self.install_lib is None and
419 self.install_purelib is None and
420 self.install_platlib is None) or
421 self.install_headers is None or
422 self.install_scripts is None or
423 self.install_data is None):
429 if self.user:
430 if self.install_userbase is None:
433 self.install_base = self.install_platbase = self.install_userbase
434 self.select_scheme("unix_user")
435 elif self.home is not None:
436 self.install_base = self.install_platbase = self.home
437 self.select_scheme("unix_home")
439 if self.prefix is None:
440 if self.exec_prefix is not None:
444 self.prefix = os.path.normpath(sys.prefix)
445 self.exec_prefix = os.path.normpath(sys.exec_prefix)
448 if self.exec_prefix is None:
449 self.exec_prefix = self.prefix
451 self.install_base = self.prefix
452 self.install_platbase = self.exec_prefix
453 self.select_scheme("unix_prefix")
455 def finalize_other(self):
457 if self.user:
458 if self.install_userbase is None:
461 self.install_base = self.install_platbase = self.install_userbase
462 self.select_scheme(os.name + "_user")
463 elif self.home is not None:
464 self.install_base = self.install_platbase = self.home
465 self.select_scheme("unix_home")
467 if self.prefix is None:
468 self.prefix = os.path.normpath(sys.prefix)
470 self.install_base = self.install_platbase = self.prefix
472 self.select_scheme(os.name)
477 def select_scheme(self, name):
483 if getattr(self, attrname) is None:
484 setattr(self, attrname, scheme[key])
486 def _expand_attrs(self, attrs):
488 val = getattr(self, attr)
492 val = subst_vars(val, self.config_vars)
493 setattr(self, attr, val)
495 def expand_basedirs(self):
498 self._expand_attrs(['install_base', 'install_platbase', 'root'])
500 def expand_dirs(self):
502 self._expand_attrs(['install_purelib', 'install_platlib',
506 def convert_paths(self, *names):
510 setattr(self, attr, convert_path(getattr(self, attr)))
512 def handle_extra_path(self):
514 if self.extra_path is None:
515 self.extra_path = self.distribution.extra_path
517 if self.extra_path is not None:
522 if isinstance(self.extra_path, str):
523 self.extra_path = self.extra_path.split(',')
525 if len(self.extra_path) == 1:
526 path_file = extra_dirs = self.extra_path[0]
527 elif len(self.extra_path) == 2:
528 path_file, extra_dirs = self.extra_path
543 self.path_file = path_file
544 self.extra_dirs = extra_dirs
546 def change_roots(self, *names):
550 setattr(self, attr, change_root(self.root, getattr(self, attr)))
552 def create_home_path(self):
554 if not self.user:
557 for name, path in self.config_vars.items():
559 self.debug_print("os.makedirs('%s', 0o700)" % path)
564 def run(self):
567 if not self.skip_build:
568 self.run_command('build')
570 build_plat = self.distribution.get_command_obj('build').plat_name
574 if self.warn_dir and build_plat != get_platform():
579 for cmd_name in self.get_sub_commands():
580 self.run_command(cmd_name)
582 if self.path_file:
583 self.create_path_file()
586 if self.record:
587 outputs = self.get_outputs()
588 if self.root: # strip any package prefix
589 root_len = len(self.root)
592 self.execute(write_file,
593 (self.record, outputs),
595 self.record)
599 install_lib = os.path.normcase(os.path.normpath(self.install_lib))
600 if (self.warn_dir and
601 not (self.path_file and self.install_path_file) and
606 self.install_lib)
608 def create_path_file(self):
610 filename = os.path.join(self.install_libbase,
611 self.path_file + ".pth")
612 if self.install_path_file:
613 self.execute(write_file,
614 (filename, [self.extra_dirs]),
617 self.warn("path file '%s' not created" % filename)
622 def get_outputs(self):
625 for cmd_name in self.get_sub_commands():
626 cmd = self.get_finalized_command(cmd_name)
633 if self.path_file and self.install_path_file:
634 outputs.append(os.path.join(self.install_libbase,
635 self.path_file + ".pth"))
639 def get_inputs(self):
643 for cmd_name in self.get_sub_commands():
644 cmd = self.get_finalized_command(cmd_name)
651 def has_lib(self):
654 return (self.distribution.has_pure_modules() or
655 self.distribution.has_ext_modules())
657 def has_headers(self):
660 return self.distribution.has_headers()
662 def has_scripts(self):
665 return self.distribution.has_scripts()
667 def has_data(self):
670 return self.distribution.has_data_files()
678 ('install_egg_info', lambda self:True),