当前位置: 首页>>代码示例>>Python>>正文


Python system.make_path函数代码示例

本文整理汇总了Python中Naked.toolshed.system.make_path函数的典型用法代码示例。如果您正苦于以下问题:Python make_path函数的具体用法?Python make_path怎么用?Python make_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了make_path函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_escape_tar_encrypt

    def test_escape_tar_encrypt(self):
        try:
            # change to the sub test directory for tar tests
            os.chdir("testdir11")
            command = "crypto --tar testtar"
            child = self.submit_same_esc_passphrase(command)
            self.assertTrue(file_exists("testtar.tar.crypt"))  # test new encrypted archive exists
            child.close()

            shutil.move('testtar', 'testtar_temp')

            decrypt_command = "decrypto testtar.tar.crypt"
            child = self.submit_same_esc_passphrase(decrypt_command)
            self.assertTrue(dir_exists(make_path("testtar")))  # test decrypted tar archive exists
            self.assertTrue(file_exists(make_path("testtar", "esc_test.txt")))
            self.assertTrue(file_exists(make_path("testtar", "esc_test2.txt")))
            child.close()

            # cleanup
            os.remove(make_path("testtar.tar.crypt"))  # remove encrypted archive
            shutil.rmtree(make_path("testtar"))        # remove the decrypted, unpacked directory
            shutil.move('testtar_temp', 'testtar')  # move the original tar testing dir back to original path
        except Exception as e:
            # return to top level testing directory
            os.chdir(self.cwd)
            raise e
        finally:
            # return to top level testing directory
            os.chdir(self.cwd)
开发者ID:CamTosh,项目名称:crypto,代码行数:29,代码来源:test_escaping-passphrase.py

示例2: unpack_and_get_keypath

 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
开发者ID:tstyle,项目名称:doxx,代码行数:27,代码来源:build.py

示例3: run

    def run(self):
        if self.app_name == None:
            i = InfoCompiler(None)
            data_container = i.getSetupFileInfo()
        else:
            i = InfoCompiler(self.app_name)
            data_container = i.getUserInfo()

        db = DirectoryBuilder(data_container)
        db.build()
        fb = FileBuilder(data_container)
        if fb.build_and_write(): # file writes were successful
            main_script_path = make_path(data_container.app_name, 'lib', data_container.app_name, 'app.py')
            settings_path = make_path(data_container.app_name, 'lib', data_container.app_name, 'settings.py')
            command_dir = make_path(data_container.app_name, 'lib', data_container.app_name, 'commands')
            setuppy_path = make_path(data_container.app_name, 'setup.py')
            print(" ")
            print(data_container.app_name + " was successfully built.")
            print(" ")
            print("-----")
            print("Main application script:  " + main_script_path)
            print("Settings file:  " + settings_path)
            print("Commands directory:  " + command_dir)
            print("setup.py file:  " + setuppy_path)
            print("-----")
            print(" ")
            print("Use 'python setup.py develop' from the top level of your project and you can begin testing your application with the executable, " + data_container.app_name)
            exit_success()
开发者ID:INAP-LABS,项目名称:noc-orchestrator,代码行数:28,代码来源:make.py

示例4: test_singlefile_encrypt_jpg

    def test_singlefile_encrypt_jpg(self):
        command = "crypto testdir1/tiger.jpg"
        child = self.submit_same_passphrase(command)
        self.assertTrue(file_exists(make_path("testdir1", "tiger.jpg.crypt")))
        child.close()

        # cleanup
        os.remove(make_path("testdir1", "tiger.jpg.crypt"))
开发者ID:CamTosh,项目名称:crypto,代码行数:8,代码来源:test_single-file.py

示例5: test_singlefile_encrypt_gif

    def test_singlefile_encrypt_gif(self):
        command = "crypto testdir1/banana.gif"
        child = self.submit_same_passphrase(command)
        self.assertTrue(file_exists(make_path("testdir1", "banana.gif.crypt")))
        child.close()

        # cleanup
        os.remove(make_path("testdir1", "banana.gif.crypt"))
开发者ID:CamTosh,项目名称:crypto,代码行数:8,代码来源:test_single-file.py

示例6: test_singlefile_encrypt_dotfile

    def test_singlefile_encrypt_dotfile(self):
        command = "crypto testdir1/.testfile"
        child = self.submit_same_passphrase(command)
        child.close()
        self.assertTrue(file_exists(make_path("testdir1", ".testfile.crypt")))

        # cleanup
        os.remove(make_path("testdir1", ".testfile.crypt"))
开发者ID:CamTosh,项目名称:crypto,代码行数:8,代码来源:test_single-file.py

示例7: test_unicode_passphrase_single_file_encrypt

    def test_unicode_passphrase_single_file_encrypt(self):
        command = "crypto testdir7/uni_test.txt"
        child = self.submit_same_uni_passphrase(command)
        self.assertTrue(file_exists(make_path("testdir7", "uni_test.txt.crypt"))) #test that new encrypted file exists
        child.close()

        # cleanup
        os.remove(make_path("testdir7","uni_test.txt.crypt"))
开发者ID:CamTosh,项目名称:crypto,代码行数:8,代码来源:test_unicode-passphrase.py

示例8: test_decrypt_singlefile_ascfile

    def test_decrypt_singlefile_ascfile(self):
        command = "decrypto testdir5/test3.txt.asc"
        child = self.submit_same_passphrase(command)
        self.assertTrue(file_exists(make_path("testdir5", "test3.txt")))
        child.close()

        # cleanup
        os.remove(make_path("testdir5", "test3.txt"))
开发者ID:CamTosh,项目名称:crypto,代码行数:8,代码来源:test_decrypt-single-file.py

示例9: setUp

	def setUp(self):
		self.sysfilepath = make_path("testfiles", "testdir", "systest.txt")
		self.sysdirpath = make_path("testfiles", "testdir")
		self.bogusfilepath = make_path("testfiles", "testdir", "bogusfile.text")
		self.metafilepath = make_path("testfiles", "keep", "metadata.txt")
		self.dir_file_path = make_path("testfiles", "keep")
		self.dir_file_list = ["file1.txt", "file2.txt", "file3.py", "metadata.txt", "test.tar.gz"]
		FileWriter(self.sysfilepath).write("test")
开发者ID:chrisidefix,项目名称:naked,代码行数:8,代码来源:test_SYSTEM.py

示例10: test_asciifile_encrypt_png

    def test_asciifile_encrypt_png(self):
        command = "crypto -a testdir1/star.png"
        child = self.submit_same_passphrase(command)
        self.assertTrue(file_exists(make_path("testdir1", "star.png.crypt")))
        child.close()

        # cleanup
        os.remove(make_path("testdir1", "star.png.crypt"))
开发者ID:CamTosh,项目名称:crypto,代码行数:8,代码来源:test_ascii-armored.py

示例11: test_multifile_goodbad_filepath

    def test_multifile_goodbad_filepath(self):
        command = "crypto testdir1/test1.txt testdir1/bogusfile.txt"
        child = self.submit_same_passphrase(command)
        self.assertTrue(file_exists(make_path("testdir1", "test1.txt.crypt")))
        self.assertFalse(file_exists(make_path("testdir1", "bogusfile.txt.crypt"))) #should not be present when original does not exist
        child.close()

        # cleanup
        os.remove(make_path("testdir1", "test1.txt.crypt"))
开发者ID:CamTosh,项目名称:crypto,代码行数:9,代码来源:test_multi-file.py

示例12: test_singlefile_encrypt_txt

    def test_singlefile_encrypt_txt(self):
        command = "crypto testdir1/test1.txt"
        child = self.submit_same_passphrase(command)
        #stdout_string = child.logfile.getvalue()
        self.assertTrue(file_exists(make_path("testdir1", "test1.txt.crypt"))) #test that new encrypted file exists
        child.close()

        # cleanup
        os.remove(make_path("testdir1","test1.txt.crypt"))
开发者ID:CamTosh,项目名称:crypto,代码行数:9,代码来源:test_single-file.py

示例13: build

    def build(self):
        top_level_dir = self.data_container.app_name
        second_level_dirs = ['docs', 'lib', 'tests']
        lib_subdir = make_path(self.data_container.app_name, 'commands')

        for xdir in second_level_dirs:
            make_dirs(make_path(top_level_dir, xdir))

        make_dirs(make_path(top_level_dir, 'lib', lib_subdir))
开发者ID:INAP-LABS,项目名称:noc-orchestrator,代码行数:9,代码来源:make.py

示例14: test_multifile_encrypt_image

    def test_multifile_encrypt_image(self):
        command = "crypto testdir1/star.png testdir1/tiger.jpg"
        child = self.submit_same_passphrase(command)
        self.assertTrue(file_exists(make_path("testdir1", "star.png.crypt")))
        self.assertTrue(file_exists(make_path("testdir1", "tiger.jpg.crypt")))
        child.close()

        # cleanup
        os.remove(make_path("testdir1", "star.png.crypt"))
        os.remove(make_path("testdir1", "tiger.jpg.crypt"))
开发者ID:CamTosh,项目名称:crypto,代码行数:10,代码来源:test_multi-file.py

示例15: test_asciifile_encrypt_multiple_files

    def test_asciifile_encrypt_multiple_files(self):
        command = "crypto --armor testdir1/.testfile testdir1/test1.txt"
        child = self.submit_same_passphrase(command)
        self.assertTrue(file_exists(make_path("testdir1", ".testfile.crypt")))
        self.assertTrue(file_exists(make_path("testdir1", "test1.txt.crypt")))
        child.close()

        # cleanup
        os.remove(make_path("testdir1", ".testfile.crypt"))
        os.remove(make_path("testdir1", "test1.txt.crypt"))
开发者ID:CamTosh,项目名称:crypto,代码行数:10,代码来源:test_ascii-armored.py


注:本文中的Naked.toolshed.system.make_path函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。