def unpack_and_get_keypath(self, project_path): # unpack the archive and get the root directory from the archive root_directory = unpack_run(project_path) if root_directory is None or root_directory == "": key_path = None try: for root, dirs, files in os.path.walk(cwd()): for test_file in files: if test_file == "project.yaml": key_path = make_path(root, dirs, test_file) except Exception as e: stderr("[!] doxx: Unable to locate the 'project.yaml' project settings file in your unpacked archive. Error: " + str(e), exit=1) if key_path is None: # can't find key path stderr("[!] doxx: Unable to locate the 'project.yaml' project settings file in your unpacked archive.", exit=1) else: return key_path # return key path to the calling method else: if root_directory == ".": key_path = 'project.yaml' # in current working directory else: # make the path to the key file root_directory = make_path(cwd(), root_directory) key_path = make_path(root_directory, 'project.yaml') # return the key path to the calling method return key_path
def __init__(self): now = datetime.datetime.now() self.py2 = py.is_py2() #truth test Python 2 interpreter self.py3 = py.is_py3() #truth test Python 3 interpreter self.py_major = py.py_major_version() #Python major version self.py_minor = py.py_minor_version() #Python minor version self.py_patch = py.py_patch_version() #Python patch version self.os = sys.platform #user operating system self.cwd = cwd() #current (present) working directory self.parent_dir = os.pardir self.default_path = os.defpath self.user_path = os.path.expanduser("~") self.string_encoding = sys.getdefaultencoding() self.file_encoding = sys.getfilesystemencoding() self.hour = now.hour self.min = now.minute self.year = now.year self.day = now.day self.month = now.month self.second = now.second
def __init__(self): self.cwd = system.cwd() self.year = str(datetime.datetime.now().year)
def test_sys_cwd_path(self): """Test that full path to the cwd is returned""" cwd_path = system.cwd() self.assertEqual(cwd_path, os.getcwd())