• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python system.make_path函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: test_multifile_encrypt_withdotfile

    def test_multifile_encrypt_withdotfile(self):
        command = "crypto testdir1/test1.txt testdir1/.testfile"
        child = self.submit_same_passphrase(command)
        self.assertTrue(file_exists(make_path("testdir1", "test1.txt.crypt")))
        self.assertTrue(file_exists(make_path("testdir1", ".testfile.crypt"))) #should encrypt an explicitly included dotfile
        child.close()

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


示例17: test_multifile_encrypt_txt

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

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


示例18: test_singledir_file_encrypt

    def test_singledir_file_encrypt(self):
        command = "crypto testdir2"
        child = self.submit_same_passphrase(command)
        child.close()
        self.assertTrue(file_exists(make_path("testdir2", "test1.txt.crypt")))
        self.assertTrue(file_exists(make_path("testdir2", "test2.txt.crypt")))
        self.assertFalse(file_exists(make_path("testdir2", "testcrypt.txt.crypt.crypt")))

        os.remove(make_path("testdir2","test1.txt.crypt"))
        os.remove(make_path("testdir2","test2.txt.crypt"))
开发者ID:CamTosh,项目名称:crypto,代码行数:10,代码来源:test_single-directory.py


示例19: test_multifile_encrypt_withencryptedfile

    def test_multifile_encrypt_withencryptedfile(self):
        command = "crypto testdir2/test1.txt testdir2/test2.txt testdir2/testcrypt.txt.crypt"
        child = self.submit_same_passphrase(command)
        self.assertTrue(file_exists(make_path("testdir2", "test1.txt.crypt")))
        self.assertTrue(file_exists(make_path("testdir2", "test2.txt.crypt")))
        self.assertFalse(file_exists(make_path("testdir2", "testcrypt.txt.crypt.crypt"))) # assert that did not encrypt previously encrypted file
        child.close()

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


示例20: test_decrypt_singlegpgfile_overwrite_shortflag

 def test_decrypt_singlegpgfile_overwrite_shortflag(self):
     command = "decrypto -o testdir6/test2.txt.gpg"
     child = pexpect.spawn(command)
     child.expect("Please enter your passphrase: ")
     child.sendline("test")
     child.expect("Please enter your passphrase again: ")
     child.sendline("test")
     child.expect("'testdir6/test2.txt.gpg' decrypted to 'testdir6/test2.txt'")
     child.close()
     self.assertTrue(file_exists(make_path("testdir6", "test2.txt"))) # confirm decrypted file present
     self.assertFalse(file_exists(make_path("testdir6", "test2.txt.tmp"))) # confirm tmp file erased
开发者ID:CamTosh,项目名称:crypto,代码行数:11,代码来源:test_decrypt-single-file.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python types.XDict类代码示例发布时间:2022-05-24
下一篇:
Python system.file_exists函数代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap