コード例 #1
0
 def export_env_vars(self):
     """Setup LD_LIBRARY_PATH and HOME environment variables.
     We follow start-tor-browser script.
     """
     tor_binary_dir = join(self.tbb_path, cm.DEFAULT_TOR_BINARY_DIR)
     environ["LD_LIBRARY_PATH"] = tor_binary_dir
     environ["FONTCONFIG_PATH"] = join(self.tbb_path,
                                       cm.DEFAULT_FONTCONFIG_PATH)
     environ["FONTCONFIG_FILE"] = cm.FONTCONFIG_FILE
     environ["HOME"] = self.tbb_browser_dir
     # Add "TBB_DIR/Browser" to the PATH, see issue #10.
     prepend_to_env_var("PATH", self.tbb_browser_dir)
コード例 #2
0
    def export_env_vars(self):
        """Setup LD_LIBRARY_PATH and HOME environment variables.

        We follow start-tor-browser script.
        """
        tor_binary_dir = join(self.tbb_path, cm.DEFAULT_TOR_BINARY_DIR)
        environ["LD_LIBRARY_PATH"] = tor_binary_dir
        environ["FONTCONFIG_PATH"] = join(self.tbb_path,
                                          cm.DEFAULT_FONTCONFIG_PATH)
        environ["FONTCONFIG_FILE"] = cm.FONTCONFIG_FILE
        environ["HOME"] = self.tbb_browser_dir
        # Add "TBB_DIR/Browser" to the PATH, see issue #10.
        prepend_to_env_var("PATH", self.tbb_browser_dir)
コード例 #3
0
    def test_prepend_to_env_var(self):
        env_var_name = "foo"
        value1 = "bar"
        value2 = "baz"

        environ[env_var_name] = value2
        ut.prepend_to_env_var(env_var_name, value1)
        self.assertEqual(environ[env_var_name], ":".join([value1, value2]))

        environ[env_var_name] = ""

        ut.prepend_to_env_var(env_var_name, value1)
        self.assertEqual(environ[env_var_name], value1)

        ut.prepend_to_env_var("non_existent_env_var", value1)
        self.assertEqual(environ["non_existent_env_var"], value1)