MCPcopy Create free account
hub / github.com/boostorg/build / workdir_set

Method workdir_set

v2/test/TestCmd.py:506–536  ·  view source on GitHub ↗

Creates a temporary working directory with the specified path name. If the path is a null string (''), a unique directory name is created.

(self, path)

Source from the content-addressed store, hash-verified

504 self.verbose = verbose
505
506 def workdir_set(self, path):
507 """
508 Creates a temporary working directory with the specified path name.
509 If the path is a null string (''), a unique directory name is created.
510
511 """
512 if os.path.isabs(path):
513 self.workdir = path
514 else:
515 if path != None:
516 if path == '':
517 path = tempfile.mktemp()
518 if path != None:
519 os.mkdir(path)
520 self._dirlist.append(path)
521 global _Cleanup
522 try:
523 _Cleanup.index(self)
524 except ValueError:
525 _Cleanup.append(self)
526 # We would like to set self.workdir like this:
527 # self.workdir = path
528 # But symlinks in the path will report things differently from
529 # os.getcwd(), so chdir there and back to fetch the canonical
530 # path.
531 cwd = os.getcwd()
532 os.chdir(path)
533 self.workdir = os.getcwd()
534 os.chdir(cwd)
535 else:
536 self.workdir = None
537
538 def workpath(self, *args):
539 """

Callers 1

__init__Method · 0.95

Calls 1

appendMethod · 0.80

Tested by

no test coverage detected