コード例 #1
0
ファイル: install.py プロジェクト: iroiro123/pydivert
    def run(self, workdir=None):
        """
        Runs the installer
        :param workdir: The working directory to use to put tarball and uncompressed files.
        """
        with cd(workdir):
            self.tarball = self.download(self.url)
            self.pkg_name = self.unzip(self.tarball)

            dll_file = os.path.join(workdir, self.pkg_name, python_isa, "WinDivert.dll")
            sys_file = os.path.join(workdir, self.pkg_name, system_isa, "WinDivert%d.sys" % (
                64 if system_isa == "amd64" else 32))

            if not os.path.exists(self.inst_dir):
                sys.stdout.write("Creating driver install directory %s" % self.inst_dir)
                os.makedirs(self.inst_dir)

            for f in (dll_file, sys_file):
                sys.stdout.write("Copying %s to %s\n" % (f, self.inst_dir))
                shutil.copy(f, self.inst_dir)
                os.chmod(os.path.join(self.inst_dir, os.path.basename(f)), 0755)

            sys.stdout.write("Trying to register driver...\n")
            self.check_driver_path(os.path.join(self.inst_dir, "WinDivert.dll"))

            sys.stdout.write("Cleaning paths...\n")
            self.clean()
コード例 #2
0
ファイル: windivert.py プロジェクト: PR3SID3NT3/pydivert
 def register(self):
     """
     An utility method to register the driver the first time.
     """
     with cd(os.path.dirname(self.dll_path)):
         handle = self.open_handle("false")
         handle.close()
コード例 #3
0
ファイル: setup.py プロジェクト: iroiro123/pydivert
    def run(self):
        from pydivert.tests import run_test_suites

        for env_name, env_value in self.extra_env.items():
            os.environ[env_name] = str(env_value)

        with cd(os.path.join(os.path.join(workdir, "pydivert", "tests"))):
            run_test_suites()
コード例 #4
0
    def run(self):
        from pydivert.tests import run_test_suites

        for env_name, env_value in self.extra_env.items():
            os.environ[env_name] = str(env_value)

        with cd(os.path.join(os.path.join(workdir, "pydivert", "tests"))):
            run_test_suites()
コード例 #5
0
ファイル: test_installer.py プロジェクト: iroiro123/pydivert
 def test_download(self):
     """
     Tests the download of a package through WinDivertInstaller class
     :return:
     """
     with cd(self.work_dir):
         local_filename = WinDivertInstaller.download(url="http://somehost/somedir/%s" % self.tarball)
         self.assertEquals(local_filename, self.tarball)
         self.assertTrue(os.path.exists(os.path.join(self.work_dir, self.tarball)))
コード例 #6
0
ファイル: test_installer.py プロジェクト: rgom/pydivert
 def test_download(self):
     """
     Tests the download of a package through WinDivertInstaller class
     :return:
     """
     with cd(self.work_dir):
         local_filename = WinDivertInstaller.download(
             url="http://somehost/somedir/%s" % self.tarball)
         self.assertEquals(local_filename, self.tarball)
         self.assertTrue(
             os.path.exists(os.path.join(self.work_dir, self.tarball)))
コード例 #7
0
ファイル: test_installer.py プロジェクト: iroiro123/pydivert
 def test_unzip(self):
     """
     Tests the uncompressing method of WinDivertInstaller class
     :return:
     """
     self.test_download()
     with cd(self.work_dir):
         expected_dir = os.path.join(self.work_dir, os.path.splitext(self.tarball)[0])
         extracted_dir = WinDivertInstaller.unzip(os.path.join(self.work_dir, self.tarball))
         self.assertEquals(extracted_dir, expected_dir)
         self.assertTrue(os.path.exists(expected_dir))
コード例 #8
0
ファイル: test_installer.py プロジェクト: rgom/pydivert
 def test_unzip(self):
     """
     Tests the uncompressing method of WinDivertInstaller class
     :return:
     """
     self.test_download()
     with cd(self.work_dir):
         expected_dir = os.path.join(self.work_dir,
                                     os.path.splitext(self.tarball)[0])
         extracted_dir = WinDivertInstaller.unzip(
             os.path.join(self.work_dir, self.tarball))
         self.assertEquals(extracted_dir, expected_dir)
         self.assertTrue(os.path.exists(expected_dir))
コード例 #9
0
ファイル: install.py プロジェクト: rgom/pydivert
    def run(self, workdir=None):
        """
        Runs the installer
        :param workdir: The working directory to use to put tarball and uncompressed files.
        """
        with cd(workdir):
            self.tarball = self.download(self.url)
            self.pkg_name = self.unzip(self.tarball)

            dll_file = os.path.join(workdir, self.pkg_name, python_isa, "WinDivert.dll")
            sys_file = os.path.join(workdir, self.pkg_name, system_isa, "WinDivert%d.sys" % (
                64 if system_isa == "amd64" else 32))

            for f in (dll_file, sys_file):
                sys.stdout.write("Copying %s to %s\n" % (f, self.inst_dir))
                shutil.copy(f, self.inst_dir)

            sys.stdout.write("Trying to register driver...\n")
            self.check_driver_path(os.path.join(self.inst_dir, "WinDivert.dll"))

            sys.stdout.write("Cleaning paths...\n")
            self.clean()