Exemplo n.º 1
0
    def test_add_to_user_path_twice_other_framework(self, expanderusermock):
        """Test that adding to user env with another framework add them twice"""
        expanderusermock.return_value = self.local_dir
        profile_file = os.path.join(self.local_dir, ".profile")
        open(profile_file, 'w').write("Foo\nBar\n")
        tools.add_env_to_user("add twice", {"FOOO": {"value": "/tmp/foo"}})

        expanderusermock.assert_called_with('~')
        profile_content = open(profile_file).read()
        self.assertTrue("Foo\nBar\n" in profile_content,
                        profile_content)  # we kept previous content
        self.assertTrue("export FOOO=/tmp/foo\n" in profile_content,
                        profile_content)

        tools.add_env_to_user("add twice with other framework",
                              {"BAR": {
                                  "value": "/tmp/bar"
                              }})

        # ensure, it's only there once
        profile_content = open(profile_file).read()
        self.assertTrue("export FOOO=/tmp/foo\n" in profile_content,
                        profile_content)
        self.assertTrue("export BAR=/tmp/bar\n" in profile_content,
                        profile_content)
Exemplo n.º 2
0
    def post_install(self):
        """Add rust necessary env variables"""
        add_env_to_user(
            self.name, {
                "PATH": {
                    "value":
                    "{}:{}:{}".format(
                        os.path.join(self.install_path, "rustc", "bin"),
                        os.path.join(self.install_path, "cargo", "bin"),
                        "$HOME/.cargo/bin")
                }
            })

        # adjust for rust: some symlinks magic to have stdlib craft available
        arch_lib_folder = '{}-unknown-linux-gnu'.format(
            self.arch_trans[get_current_arch()])
        lib_folder = os.path.join(self.install_path,
                                  'rust-std-{}'.format(arch_lib_folder), 'lib',
                                  'rustlib', arch_lib_folder, 'lib')
        arch_dest_lib_folder = os.path.join(self.install_path, 'rustc', 'lib',
                                            'rustlib', arch_lib_folder, 'lib')
        os.mkdir(arch_dest_lib_folder)
        for f in os.listdir(lib_folder):
            os.symlink(os.path.join(lib_folder, f),
                       os.path.join(arch_dest_lib_folder, f))

        UI.delayed_display(
            DisplayMessage(self.RELOGIN_REQUIRE_MSG.format(self.name)))
Exemplo n.º 3
0
 def post_install(self):
     """Add go necessary env variables"""
     add_env_to_user(
         self.name,
         {"PATH": {"value": os.path.join(self.install_path, "bin")}, "GOROOT": {"value": self.install_path}},
     )
     UI.delayed_display(DisplayMessage(_("You need to restart a shell session for your installation to work")))
Exemplo n.º 4
0
    def post_install(self):
        """Add necessary environment variables"""
        # add a few fall-back variables that might be used by some tools
        # do not set ANDROID_SDK_HOME here as that is the path of the preference folder expected by the Android tools
        add_env_to_user(
            self.name, {
                "ANDROID_HOME": {
                    "value": self.install_path,
                    "keep": False
                },
                "ANDROID_SDK": {
                    "value": self.install_path,
                    "keep": False
                },
                "PATH": {
                    "value": [
                        os.path.join(self.install_path, "tools"),
                        os.path.join(self.install_path, "tools", "bin")
                    ]
                }
            })
        UI.delayed_display(
            DisplayMessage(self.RELOGIN_REQUIRE_MSG.format(self.name)))

        # print wiki page message
        UI.delayed_display(
            DisplayMessage(
                "SDK installed in {}. More information on how to use it on {}".
                format(
                    self.install_path,
                    "https://developer.android.com/sdk/installing/adding-packages.html"
                )))
Exemplo n.º 5
0
    def post_install(self):
        """Add necessary environment variables"""
        # add a few fall-back variables that might be used by some tools
        add_env_to_user(
            self.name, {
                "NDK_ROOT": {
                    "value": self.install_path,
                    "keep": False
                },
                "ANDROID_NDK": {
                    "value": self.install_path,
                    "keep": False
                },
                "ANDROID_NDK_HOME": {
                    "value": self.install_path,
                    "keep": False
                }
            })

        # print wiki page message
        UI.display(
            DisplayMessage(
                "NDK installed in {}. More information on how to use it on {}".
                format(
                    self.install_path,
                    "https://developer.android.com/tools/sdk/ndk/index.html#GetStarted"
                )))
Exemplo n.º 6
0
    def post_install(self):
        """Add necessary environment variables"""
        add_env_to_user(
            self.name,
            {"ANDROID_HOME": {
                "value": self.install_path,
                "keep": False
            }})
        # add "platform-tools" to PATH to ensure "adb" can be run once the platform tools are installed via
        # the SDK manager
        add_env_to_user(
            self.name, {
                "PATH": {
                    "value": [
                        os.path.join("$ANDROID_HOME", "tools"),
                        os.path.join("$ANDROID_HOME", "platform-tools")
                    ]
                }
            })
        UI.delayed_display(
            DisplayMessage(self.RELOGIN_REQUIRE_MSG.format(self.name)))

        # print wiki page message
        UI.delayed_display(
            DisplayMessage(
                "SDK installed in {}. More information on how to use it on {}".
                format(
                    self.install_path,
                    "https://developer.android.com/sdk/installing/adding-packages.html"
                )))
Exemplo n.º 7
0
    def post_install(self):
        """Add rust necessary env variables"""
        add_env_to_user(
            self.name, {
                "PATH": {
                    "value":
                    "{}:{}".format(
                        os.path.join(self.install_path, "rustc", "bin"),
                        os.path.join(self.install_path, "cargo", "bin"))
                },
                "LD_LIBRARY_PATH": {
                    "value": os.path.join(self.install_path, "rustc", "lib")
                }
            })

        # adjust for rust 1.5 some symlinks magic to have stdlib craft available
        os.chdir(os.path.join(self.install_path, "rustc", "lib"))
        os.rename("rustlib", "rustlib.init")
        os.symlink(
            glob(os.path.join('..', '..', 'rust-std-*', 'lib', 'rustlib'))[0],
            'rustlib')
        os.symlink(os.path.join('..', 'rustlib.init', 'etc'),
                   os.path.join('rustlib', 'etc'))

        UI.delayed_display(
            DisplayMessage(self.RELOGIN_REQUIRE_MSG.format(self.name)))
Exemplo n.º 8
0
 def post_install(self):
     """Add rust necessary env variables"""
     add_env_to_user(self.name, {"PATH": {"value": "{}:{}".format(os.path.join(self.install_path, "rustc", "bin"),
                                                                  os.path.join(self.install_path, "cargo", "bin"))},
                                 "LD_LIBRARY_PATH": {"value": os.path.join(self.install_path, "rustc", "lib")}})
     UI.delayed_display(DisplayMessage(_("You need to restart your current shell session for your {} installation "
                                         "to work properly").format(self.name)))
Exemplo n.º 9
0
    def post_install(self):
        """Add rust necessary env variables"""
        add_env_to_user(
            self.name, {
                "PATH": {
                    "value":
                    "{}:{}".format(
                        os.path.join(self.install_path, "rustc", "bin"),
                        os.path.join(self.install_path, "cargo", "bin"))
                },
                "LD_LIBRARY_PATH": {
                    "value": os.path.join(self.install_path, "rustc", "lib")
                }
            })

        # adjust for rust 1.5 some symlinks magic to have stdlib craft available
        os.chdir(os.path.join(self.install_path, "rustc", "lib"))
        os.rename("rustlib", "rustlib.init")
        os.symlink(
            glob(os.path.join('..', '..', 'rust-std-*', 'lib', 'rustlib'))[0],
            'rustlib')
        os.symlink(os.path.join('..', 'rustlib.init', 'etc'),
                   os.path.join('rustlib', 'etc'))

        UI.delayed_display(
            DisplayMessage(
                _("You need to restart your current shell session for your {} installation "
                  "to work properly").format(self.name)))
Exemplo n.º 10
0
    def post_install(self):
        """Add necessary environment variables"""
        add_env_to_user(self.name, {"ANDROID_HOME": {"value": self.install_path, "keep": False}})
        # add "platform-tools" to PATH to ensure "adb" can be run once the platform tools are installed via
        # the SDK manager
        add_env_to_user(
            self.name,
            {
                "PATH": {
                    "value": [os.path.join("$ANDROID_HOME", "tools"), os.path.join("$ANDROID_HOME", "platform-tools")]
                }
            },
        )
        UI.delayed_display(
            DisplayMessage(
                _("You need to restart your current shell session for your {} installation " "to work properly").format(
                    self.name
                )
            )
        )

        # print wiki page message
        UI.delayed_display(
            DisplayMessage(
                "SDK installed in {}. More information on how to use it on {}".format(
                    self.install_path, "https://developer.android.com/sdk/installing/adding-packages.html"
                )
            )
        )
Exemplo n.º 11
0
 def post_install(self):
     """Add the Geckodriver binary dir to PATH"""
     add_env_to_user(self.name,
                     {"PATH": {
                         "value": os.path.join(self.install_path)
                     }})
     UI.delayed_display(
         DisplayMessage(self.RELOGIN_REQUIRE_MSG.format(self.name)))
Exemplo n.º 12
0
 def post_install(self):
     """Add Terraform necessary env variables"""
     add_env_to_user(self.name,
                     {"PATH": {
                         "value": os.path.join(self.install_path)
                     }})
     UI.delayed_display(
         DisplayMessage(self.RELOGIN_REQUIRE_MSG.format(self.name)))
Exemplo n.º 13
0
 def post_install(self):
     """Add nodejs necessary env variables and move module folder"""
     subprocess.call([os.path.join(self.install_path, "bin", "npm"), "config", "set", "prefix", "~/.node_modules"])
     add_env_to_user(self.name, {"PATH": {"value": "{}:{}".format(os.path.join(self.install_path, "bin"),
                                                                  os.path.join(os.path.expanduser('~'),
                                                                               ".node_modules", "bin"))}})
     UI.delayed_display(DisplayMessage(_("You need to restart your current shell session for your {} installation "
                                         "to work properly").format(self.name)))
Exemplo n.º 14
0
    def post_install(self):
        """Add necessary environment variables"""
        add_env_to_user(self.name, {"NDK_ROOT": {"value": self.install_path, "keep": False}})

        # print wiki page message
        UI.display(DisplayMessage("NDK installed in {}. More information on how to use it on {}".format(
                                  self.install_path,
                                  "https://developer.android.com/tools/sdk/ndk/index.html#GetStarted")))
Exemplo n.º 15
0
 def post_install(self):
     """Add necessary environment variables"""
     add_env_to_user(self.name, {
         "PATH": {
             "value": [os.path.join(self.install_path, "platform-tools")]
         }
     })
     UI.delayed_display(
         DisplayMessage(self.RELOGIN_REQUIRE_MSG.format(self.name)))
Exemplo n.º 16
0
 def post_install(self):
     """Add the necessary Maven environment variables"""
     add_env_to_user(
         self.name,
         {"PATH": {
             "value": os.path.join(self.install_path, "bin")
         }})
     UI.delayed_display(
         DisplayMessage(self.RELOGIN_REQUIRE_MSG.format(self.name)))
Exemplo n.º 17
0
 def post_install(self):
     """Create the Android Studio launcher"""
     add_env_to_user(self.name, {"ANDROID_HOME": {"value": self.install_path, "keep": False}})
     create_launcher(self.desktop_filename, get_application_desktop_file(name=_("Android Studio"),
                     icon_path=os.path.join(self.install_path, "bin", "studio.png"),
                     try_exec=os.path.join(self.install_path, "bin", "studio.sh"),
                     exec=self.exec_link_name,
                     comment=_("Android Studio developer environment"),
                     categories="Development;IDE;",
                     extra="StartupWMClass=jetbrains-studio"))
Exemplo n.º 18
0
    def test_add_env_to_user_empty_file(self, expanderusermock):
        """Test that adding to user env append to an non existing .profile file"""
        expanderusermock.return_value = self.local_dir
        profile_file = os.path.join(self.local_dir, ".profile")
        tools.add_env_to_user("one path addition", {"FOOO": {"value": "/tmp/foo"}})

        expanderusermock.assert_called_with('~')
        profile_content = open(profile_file).read()
        self.assertTrue("export FOOO=/tmp/foo\n" in profile_content, profile_content)
        self.assertTrue("/tmp/foo" in os.environ["FOOO"], os.environ["FOOO"])
Exemplo n.º 19
0
    def post_install(self):
        """Add nodejs necessary env variables and move module folder"""
        if not self.prefix_set():
            with open(os.path.join(os.environ['HOME'], '.npmrc'), 'a+') as file:
                file.write("prefix = ${HOME}/.npm_modules\n")

        add_env_to_user(self.name, {"PATH": {"value": "{}:{}".format(os.path.join(self.install_path, "bin"),
                                                                     os.path.join(os.path.expanduser('~'),
                                                                                  ".npm_modules", "bin"))}})
        UI.delayed_display(DisplayMessage(self.RELOGIN_REQUIRE_MSG.format(self.name)))
Exemplo n.º 20
0
    def post_install(self):
        """Add nodejs necessary env variables and move module folder"""
        if not self.prefix_set():
            with open(os.path.join(os.environ['HOME'], '.npmrc'), 'a+') as file:
                file.write("prefix = ${HOME}/.npm_modules\n")

        add_env_to_user(self.name, {"PATH": {"value": "{}:{}".format(os.path.join(self.install_path, "bin"),
                                                                     os.path.join(os.path.expanduser('~'),
                                                                                  ".npm_modules", "bin"))}})
        UI.delayed_display(DisplayMessage(self.RELOGIN_REQUIRE_MSG.format(self.name)))
Exemplo n.º 21
0
 def post_install(self):
     """Add go necessary env variables"""
     add_env_to_user(
         self.name,
         {"PATH": {
             "value": os.path.join(self.install_path, "bin")
         }})
     UI.delayed_display(
         DisplayMessage(
             _("You need to restart a shell session for your installation to work"
               )))
Exemplo n.º 22
0
 def post_install(self):
     """Add the necessary OpenJFX environment variables"""
     add_env_to_user(
         self.name, {
             "PATH_TO_FX": {
                 "value": os.path.join(self.install_path, "lib"),
                 "keep": False
             }
         })
     UI.delayed_display(
         DisplayMessage(self.RELOGIN_REQUIRE_MSG.format(self.name)))
Exemplo n.º 23
0
 def post_install(self):
     """Create the Android Studio launcher"""
     add_env_to_user(self.name, {"ANDROID_HOME": {"value": self.install_path, "keep": False},
                                 "ANDROID_SDK": {"value": self.install_path, "keep": False}})
     create_launcher(self.desktop_filename, get_application_desktop_file(name=_("Android Studio"),
                     icon_path=os.path.join(self.install_path, "bin", "studio.png"),
                     try_exec=os.path.join(self.install_path, "bin", "studio.sh"),
                     exec=self.exec_link_name,
                     comment=_("Android Studio developer environment"),
                     categories="Development;IDE;",
                     extra="StartupWMClass=jetbrains-studio"))
Exemplo n.º 24
0
 def post_install(self):
     """Add go necessary env variables"""
     add_env_to_user(
         self.name,
         {"PATH": {
             "value": os.path.join(self.install_path, "bin")
         }})
     UI.delayed_display(
         DisplayMessage(
             _("You need to restart your current shell session for your {} installation "
               "to work properly").format(self.name)))
Exemplo n.º 25
0
    def test_add_path_to_user(self, expanderusermock):
        """Test that adding to user path doesn't export as PATH is already exported"""
        expanderusermock.return_value = self.local_dir
        profile_file = os.path.join(self.local_dir, ".profile")
        open(profile_file, 'w').write("Foo\nBar\n")
        tools.add_env_to_user("one path addition", {"PATH": {"value": "/tmp/bar"}})

        expanderusermock.assert_called_with('~')
        profile_content = open(profile_file).read()
        self.assertTrue("Foo\nBar\n" in profile_content, profile_content)  # we kept previous content
        self.assertTrue("\nPATH=/tmp/bar:$PATH\n" in profile_content, profile_content)
        self.assertTrue("/tmp/bar" in os.environ["PATH"], os.environ["PATH"])
Exemplo n.º 26
0
    def test_add_env_to_user(self, expanderusermock):
        """Test that adding to user env appending to an existing .profile file"""
        expanderusermock.return_value = self.local_dir
        profile_file = os.path.join(self.local_dir, ".profile")
        open(profile_file, 'w').write("Foo\nBar\n")
        tools.add_env_to_user("one path addition", {"FOOO": {"value": "bar"}})

        expanderusermock.assert_called_with('~')
        profile_content = open(profile_file).read()
        self.assertTrue("Foo\nBar\n" in profile_content, profile_content)  # we kept previous content
        self.assertTrue("export FOOO=bar\n" in profile_content, profile_content)
        self.assertTrue("bar" in os.environ["FOOO"], os.environ["FOOO"])
Exemplo n.º 27
0
    def post_install(self):
        """Add rust necessary env variables"""
        add_env_to_user(self.name, {"PATH": {"value": "{}:{}".format(os.path.join(self.install_path, "rustc", "bin"),
                                                                     os.path.join(self.install_path, "cargo", "bin"))},
                                    "LD_LIBRARY_PATH": {"value": os.path.join(self.install_path, "rustc", "lib")}})

        # adjust for rust 1.5 some symlinks magic to have stdlib craft available
        os.chdir(os.path.join(self.install_path, "rustc", "lib"))
        os.rename("rustlib", "rustlib.init")
        os.symlink(glob(os.path.join('..', '..', 'rust-std-*', 'lib', 'rustlib'))[0], 'rustlib')
        os.symlink(os.path.join('..', 'rustlib.init', 'etc'), os.path.join('rustlib', 'etc'))

        UI.delayed_display(DisplayMessage(self.RELOGIN_REQUIRE_MSG.format(self.name)))
Exemplo n.º 28
0
    def test_add_env_to_user_multiple(self, expanderusermock):
        """Test that adding to user with multiple env for same framework appending to an existing .profile file"""
        expanderusermock.return_value = self.local_dir
        profile_file = os.path.join(self.local_dir, ".profile")
        open(profile_file, 'w').write("Foo\nBar\n")
        tools.add_env_to_user("one path addition", {"FOOO": {"value": "bar"}, "BAR": {"value": "foo"}})

        expanderusermock.assert_called_with('~')
        profile_content = open(profile_file).read()
        self.assertTrue("Foo\nBar\n" in profile_content, profile_content)  # we kept previous content
        self.assertTrue("export FOOO=bar\n" in profile_content, profile_content)
        self.assertTrue("export BAR=foo\n" in profile_content, profile_content)
        self.assertEqual(os.environ["FOOO"], "bar")
        self.assertEqual(os.environ["BAR"], "foo")
Exemplo n.º 29
0
    def post_install(self):
        """Add necessary environment variables"""
        # add a few fall-back variables that might be used by some tools
        # do not set ANDROID_SDK_HOME here as that is the path of the preference folder expected by the Android tools
        add_env_to_user(self.name, {"ANDROID_HOME": {"value": self.install_path, "keep": False},
                                    "ANDROID_SDK": {"value": self.install_path, "keep": False},
                                    "PATH": {"value": [os.path.join(self.install_path, "tools"),
                                                       os.path.join(self.install_path, "tools", "bin")]}})
        UI.delayed_display(DisplayMessage(self.RELOGIN_REQUIRE_MSG.format(self.name)))

        # print wiki page message
        UI.delayed_display(DisplayMessage("SDK installed in {}. More information on how to use it on {}".format(
                                          self.install_path,
                                          "https://developer.android.com/sdk/installing/adding-packages.html")))
Exemplo n.º 30
0
    def post_install(self):
        """Add rust necessary env variables"""
        add_env_to_user(self.name, {"PATH": {"value": "{}:{}".format(os.path.join(self.install_path, "rustc", "bin"),
                                                                     os.path.join(self.install_path, "cargo", "bin"))},
                                    "LD_LIBRARY_PATH": {"value": os.path.join(self.install_path, "rustc", "lib")}})

        # adjust for rust 1.5 some symlinks magic to have stdlib craft available
        os.chdir(os.path.join(self.install_path, "rustc", "lib"))
        os.rename("rustlib", "rustlib.init")
        os.symlink(glob(os.path.join('..', '..', 'rust-std-*', 'lib', 'rustlib'))[0], 'rustlib')
        os.symlink(os.path.join('..', 'rustlib.init', 'etc'), os.path.join('rustlib', 'etc'))

        UI.delayed_display(DisplayMessage(_("You need to restart your current shell session for your {} installation "
                                            "to work properly").format(self.name)))
Exemplo n.º 31
0
 def post_install(self):
     """Add go necessary env variables"""
     add_env_to_user(
         self.name, {
             "PATH": {
                 "value": os.path.join(self.install_path, "bin")
             },
             "GOROOT": {
                 "value": self.install_path,
                 "keep": False
             }
         })
     UI.delayed_display(
         DisplayMessage(self.RELOGIN_REQUIRE_MSG.format(self.name)))
Exemplo n.º 32
0
    def post_install(self):
        """Add rust necessary env variables"""
        add_env_to_user(self.name, {"PATH": {"value": "{}:{}".format(os.path.join(self.install_path, "rustc", "bin"),
                                                                     os.path.join(self.install_path, "cargo", "bin"))},
                                    "LD_LIBRARY_PATH": {"value": os.path.join(self.install_path, "rustc", "lib")}})

        # adjust for rust: some symlinks magic to have stdlib craft available
        arch_lib_folder = '{}-unknown-linux-gnu'.format(self.arch_trans[get_current_arch()])
        lib_folder = os.path.join(self.install_path, 'rust-std-{}'.format(arch_lib_folder),
                                  'lib', 'rustlib', arch_lib_folder, 'lib')
        for f in os.listdir(lib_folder):
            os.symlink(os.path.join(lib_folder, f),
                       os.path.join(self.install_path, 'rustc', 'lib', 'rustlib', arch_lib_folder, 'lib', f))

        UI.delayed_display(DisplayMessage(self.RELOGIN_REQUIRE_MSG.format(self.name)))
Exemplo n.º 33
0
    def test_add_env_to_user_not_keep(self, expanderusermock):
        """Test that adding to user env without keep replace an existing env"""
        os.environ["FOOO"] = "foo"
        expanderusermock.return_value = self.local_dir
        profile_file = os.path.join(self.local_dir, ".profile")
        open(profile_file, 'w').write("Foo\nBar\n")
        tools.add_env_to_user("one path addition", {"FOOO": {"value": "bar", "keep": False}})

        expanderusermock.assert_called_with('~')
        profile_content = open(profile_file).read()
        self.assertTrue("Foo\nBar\n" in profile_content, profile_content)  # we kept previous content
        self.assertTrue("export FOOO=bar\n" in profile_content, profile_content)
        self.assertTrue("bar" in os.environ["FOOO"], os.environ["FOOO"])
        self.assertFalse("foo" in os.environ["FOOO"], os.environ["FOOO"])
        self.assertEqual(os.environ["FOOO"], "bar")
Exemplo n.º 34
0
 def post_install(self):
     """Add the necessary Scala environment variables"""
     add_env_to_user(
         self.name, {
             "PATH": {
                 "value": os.path.join(self.install_path, "bin")
             },
             "SCALA_HOME": {
                 "value": self.install_path
             }
         })
     UI.delayed_display(
         DisplayMessage(
             _("You need to restart the shell session for your installation to work"
               )))
Exemplo n.º 35
0
 def post_install(self):
     """Add necessary environment variables"""
     add_env_to_user(
         self.name,
         {"ANDROID_NDK": {
             "value": self.install_path,
             "keep": False
         }})
     """Print wiki page message"""
     UI.display(
         DisplayMessage(
             "NDK installed in {}. More information on how to use it on {}".
             format(
                 self.install_path,
                 "https://developer.android.com/tools/sdk/ndk/index.html#GetStarted"
             )))
Exemplo n.º 36
0
    def test_add_to_user_path_twice(self, expanderusermock):
        """Test that adding to user env twice doesn't add it twice in the file"""
        expanderusermock.return_value = self.local_dir
        profile_file = os.path.join(self.local_dir, ".profile")
        open(profile_file, "w").write("Foo\nBar\n")
        tools.add_env_to_user("add twice", {"FOOO": {"value": "/tmp/foo"}})

        expanderusermock.assert_called_with("~")
        profile_content = open(profile_file).read()
        self.assertTrue("Foo\nBar\n" in profile_content, profile_content)  # we kept previous content
        self.assertTrue("export FOOO=/tmp/foo\n" in profile_content, profile_content)

        tools.add_env_to_user("add twice", {"FOOO": {"value": "/tmp/foo"}})

        # ensure, it's only there once
        profile_content = open(profile_file).read()
        self.assertEqual(profile_content.count("export FOOO=/tmp/foo"), 1, profile_content)
Exemplo n.º 37
0
    def test_add_to_user_path_twice_with_new_content(self, expanderusermock):
        """Test that adding to some env twice for same framework only add the latest"""
        expanderusermock.return_value = self.local_dir
        profile_file = os.path.join(self.local_dir, ".profile")
        open(profile_file, 'w').write("Foo\nBar\n")
        tools.add_env_to_user("add twice", {"FOOO": {"value": "/tmp/foo"}})

        expanderusermock.assert_called_with('~')
        profile_content = open(profile_file).read()
        self.assertTrue("Foo\nBar\n" in profile_content, profile_content)  # we kept previous content
        self.assertTrue("export FOOO=/tmp/foo\n" in profile_content, profile_content)

        tools.add_env_to_user("add twice", {"FOOO": {"value": "/tmp/bar"}})

        # ensure, it's only there once
        profile_content = open(profile_file).read()
        self.assertEqual(profile_content.count("export FOOO=/tmp/bar"), 1, profile_content)
Exemplo n.º 38
0
    def test_add_to_user_path_twice_other_framework(self, expanderusermock):
        """Test that adding to user env with another framework add them twice"""
        expanderusermock.return_value = self.local_dir
        profile_file = os.path.join(self.local_dir, ".profile")
        open(profile_file, 'w').write("Foo\nBar\n")
        tools.add_env_to_user("add twice", {"FOOO": {"value": "/tmp/foo"}})

        expanderusermock.assert_called_with('~')
        profile_content = open(profile_file).read()
        self.assertTrue("Foo\nBar\n" in profile_content, profile_content)  # we kept previous content
        self.assertTrue("export FOOO=/tmp/foo\n" in profile_content, profile_content)

        tools.add_env_to_user("add twice with other framework", {"BAR": {"value": "/tmp/bar"}})

        # ensure, it's only there once
        profile_content = open(profile_file).read()
        self.assertTrue("export FOOO=/tmp/foo\n" in profile_content, profile_content)
        self.assertTrue("export BAR=/tmp/bar\n" in profile_content, profile_content)
Exemplo n.º 39
0
 def post_install(self):
     """Add nodejs necessary env variables and move module folder"""
     subprocess.call([
         os.path.join(self.install_path, "bin", "npm"), "config", "set",
         "prefix", "~/.node_modules"
     ])
     add_env_to_user(
         self.name, {
             "PATH": {
                 "value":
                 "{}:{}".format(
                     os.path.join(self.install_path, "bin"),
                     os.path.join(os.path.expanduser('~'), ".node_modules",
                                  "bin"))
             }
         })
     UI.delayed_display(
         DisplayMessage(
             _("You need to restart your current shell session for your {} installation "
               "to work properly").format(self.name)))
Exemplo n.º 40
0
 def post_install(self):
     """Add the necessary Maven environment variables"""
     add_env_to_user(self.name, {"PATH": {"value": os.path.join(self.install_path, "bin")}})
     UI.delayed_display(DisplayMessage(self.RELOGIN_REQUIRE_MSG.format(self.name)))
Exemplo n.º 41
0
 def post_install(self):
     """Add necessary environment variables"""
     add_env_to_user(self.name, {"PATH": {"value": [os.path.join(self.install_path, "platform-tools")]}})
     UI.delayed_display(DisplayMessage(self.RELOGIN_REQUIRE_MSG.format(self.name)))
Exemplo n.º 42
0
 def post_install(self):
     """Add the Kotlin binary dir to PATH"""
     add_env_to_user(self.name, {"PATH": {"value": os.path.join(self.install_path, "bin")}})
     UI.delayed_display(DisplayMessage(_("You need to restart your current shell session for your {} installation "
                                         "to work properly").format(self.name)))
Exemplo n.º 43
0
 def post_install(self):
     """Add the necessary Scala environment variables"""
     add_env_to_user(self.name, {"PATH": {"value": os.path.join(self.install_path, "bin")},
                                 "SCALA_HOME": {"value": self.install_path}})
     UI.delayed_display(DisplayMessage(_("You need to restart your current shell session for your {} installation "
                                         "to work properly").format(self.name)))
Exemplo n.º 44
0
 def post_install(self):
     """Add go necessary env variables"""
     add_env_to_user(self.name, {"PATH": {"value": os.path.join(self.install_path, "bin")},
                                 "GOROOT": {"value": self.install_path, "keep": False}})
     UI.delayed_display(DisplayMessage(self.RELOGIN_REQUIRE_MSG.format(self.name)))
Exemplo n.º 45
0
 def post_install(self):
     """Add the Kotlin binary dir to PATH"""
     add_env_to_user(self.name, {"PATH": {"value": os.path.join(self.install_path, "bin")}})
     UI.delayed_display(DisplayMessage(self.RELOGIN_REQUIRE_MSG.format(self.name)))
Exemplo n.º 46
0
 def post_install(self):
     """Add go necessary env variables"""
     add_env_to_user(self.name, {"PATH": {"value": os.path.join(self.install_path, "bin")},
                                 "GOROOT": {"value": self.install_path, "keep": False}})
     UI.delayed_display(DisplayMessage(_("You need to restart your current shell session for your {} installation "
                                         "to work properly").format(self.name)))