コード例 #1
0
 def _display(self, contentType):
     # print depending on the content type
     while True:
         try:
             if isinstance(contentType, InputText):
                 contentType.run_callback(result=rlinput(
                     contentType.content, contentType.default_input))
             elif isinstance(contentType, LicenseAgreement):
                 print(contentType.content)
                 contentType.choose(answer=input(contentType.input))
             elif isinstance(contentType, TextWithChoices):
                 contentType.choose(answer=input(contentType.prompt))
             elif isinstance(contentType, DisplayMessage):
                 print(contentType.text)
             elif isinstance(contentType, UnknownProgress):
                 if not contentType.bar:
                     contentType.bar = ProgressBar(widgets=[BouncingBar()])
                 with suppress(StopIteration, AttributeError):
                     # pulse and add a timeout callback
                     contentType.bar(contentType._iterator()).next()
                     UI.delayed_display(contentType)
                 # don't recall the callback
                 return False
             else:
                 logger.error(
                     "Unexcepted content type to display to CLI UI: {}".
                     format(contentType))
                 MainLoop().quit(status_code=1)
             break
         except InputError as e:
             logger.error(str(e))
             continue
コード例 #2
0
ファイル: go.py プロジェクト: fcole90/ubuntu-make
 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")))
コード例 #3
0
    def remove(self):
        """Remove current framework if installed

        Not that we only remove desktop file, launcher icon and dir content, we do not remove
        packages as they might be in used for other framework"""
        # check if it's installed and so on.
        super().remove()

        UI.display(DisplayMessage("Removing {}".format(self.name)))
        if self.desktop_filename:
            with suppress(FileNotFoundError):
                os.remove(get_launcher_path(self.desktop_filename))
                os.remove(
                    os.path.join(self.default_binary_link_path,
                                 self.exec_link_name))
        if self.icon_filename:
            with suppress(FileNotFoundError):
                os.remove(get_icon_path(self.icon_filename))
        with suppress(FileNotFoundError):
            shutil.rmtree(self.install_path)
            path = os.path.dirname(self.install_path)
            while path is not DEFAULT_INSTALL_TOOLS_PATH:
                if os.listdir(path) == []:
                    logger.debug(
                        "Empty folder, cleaning recursively: {}".format(path))
                    os.rmdir(path)
                    path = os.path.dirname(path)
                else:
                    break
        remove_framework_envs_from_user(self.name)
        self.remove_from_config()

        UI.delayed_display(DisplayMessage("Suppression done"))
        UI.return_main_screen()
コード例 #4
0
ファイル: rust.py プロジェクト: pombredanne/ubuntu-make
 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)))
コード例 #5
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)))
コード例 #6
0
    def remove(self):
        """Remove current framework if installed

        Not that we only remove desktop file, launcher icon and dir content, we do not remove
        packages as they might be in used for other framework"""
        # check if it's installed and so on.
        super().remove()

        UI.display(DisplayMessage("Removing {}".format(self.name)))
        if self.desktop_filename:
            with suppress(FileNotFoundError):
                os.remove(get_launcher_path(self.desktop_filename))
                os.remove(
                    os.path.join(self.default_binary_link_path,
                                 self.exec_link_name))
        if self.icon_filename:
            with suppress(FileNotFoundError):
                os.remove(get_icon_path(self.icon_filename))
        with suppress(FileNotFoundError):
            shutil.rmtree(self.install_path)
        remove_framework_envs_from_user(self.name)
        self.remove_from_config()

        UI.delayed_display(DisplayMessage("Suppression done"))
        UI.return_main_screen()
コード例 #7
0
ファイル: android.py プロジェクト: oijazsh/ubuntu-make
    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"
                )
            )
        )
コード例 #8
0
ファイル: rust.py プロジェクト: simoncaron/ubuntu-make
    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)))
コード例 #9
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"
                )))
コード例 #10
0
    def get_metadata_and_check_license(self, result):
        """Diverge from the baseinstaller implementation in order to allow language selection"""

        logger.debug("Parse download metadata")
        error_msg = result[self.download_page].error
        if error_msg:
            logger.error("An error occurred while downloading {}: {}".format(
                self.download_page, error_msg))
            UI.return_main_screen(status_code=1)

        arch = platform.machine()
        arg_lang_url = None
        default_label = ''
        tag_machine = ''
        if arch == 'x86_64':
            tag_machine = '64'

        reg_expression = r'href="(\S+os=linux{}&lang=\S+)"'.format(
            tag_machine)
        languages = []
        decoded_page = result[self.download_page].buffer.getvalue().decode()
        for index, p in enumerate(re.finditer(reg_expression, decoded_page)):
            with suppress(AttributeError):
                url = p.group(1)

            m = re.search(r'lang=(.*)', url)
            with suppress(AttributeError):
                lang = m.group(1)

            if self.arg_lang and self.arg_lang.lower() == lang.lower():
                arg_lang_url = url
                break
            else:
                is_default_choice = False
                if lang == "en-US":
                    default_label = "(default: en-US)"
                    is_default_choice = True
                choice = Choice(index,
                                lang,
                                partial(self.language_select_callback, url),
                                is_default=is_default_choice)
                languages.append(choice)

        if self.arg_lang:
            logger.debug("Selecting {} lang".format(self.arg_lang))
            if not arg_lang_url:
                logger.error(
                    "Could not find a download url for language {}".format(
                        self.arg_lang))
                UI.return_main_screen(status_code=1)
            self.language_select_callback(arg_lang_url)
        else:
            if not languages:
                logger.error(
                    "Download page changed its syntax or is not parsable")
                UI.return_main_screen(status_code=1)
            logger.debug("Check list of installable languages.")
            UI.delayed_display(
                TextWithChoices(_("Choose language: {}".format(default_label)),
                                languages, True))
コード例 #11
0
ファイル: __init__.py プロジェクト: Ubuntu420/ubuntu-make
 def _display(self, contentType):
     # print depending on the content type
     while True:
         try:
             if isinstance(contentType, InputText):
                 contentType.run_callback(result=rlinput(contentType.content, contentType.default_input))
             elif isinstance(contentType, LicenseAgreement):
                 print(contentType.content)
                 contentType.choose(answer=input(contentType.input))
             elif isinstance(contentType, TextWithChoices):
                 contentType.choose(answer=input(contentType.prompt))
             elif isinstance(contentType, DisplayMessage):
                 print(contentType.text)
             elif isinstance(contentType, UnknownProgress):
                 if not contentType.bar:
                     contentType.bar = ProgressBar(widgets=[BouncingBar()])
                 with suppress(StopIteration):
                     # pulse and add a timeout callback
                     contentType.bar(contentType._iterator()).next()
                     UI.delayed_display(contentType)
                 # don't recall the callback
                 return False
             else:
                 logger.error("Unexcepted content type to display to CLI UI: {}".format(contentType))
                 MainLoop().quit(status_code=1)
             break
         except InputError as e:
             logger.error(str(e))
             continue
コード例 #12
0
ファイル: rust.py プロジェクト: shanenelson/ubuntu-make
    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)))
コード例 #13
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"
                )))
コード例 #14
0
ファイル: nodejs.py プロジェクト: EdRondon/ubuntu-make
 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)))
コード例 #15
0
ファイル: devops.py プロジェクト: vishwas1234567/ubuntu-make
 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)))
コード例 #16
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)))
コード例 #17
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)))
コード例 #18
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)))
コード例 #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)))
コード例 #20
0
ファイル: nodejs.py プロジェクト: ubuntu/ubuntu-make
    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)))
コード例 #21
0
ファイル: java.py プロジェクト: radendel/ubuntu-make
 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)))
コード例 #22
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"
               )))
コード例 #23
0
ファイル: dart.py プロジェクト: shanenelson/ubuntu-make
 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)))
コード例 #24
0
ファイル: test_ui.py プロジェクト: EdRondon/ubuntu-make
    def test_call_delayed_display(self, mocksys):
        """We call the display method from the UIPlug in delayed_display with 50ms waiting"""
        UI.delayed_display(self.contentType)
        now = time()
        self.start_glib_mainloop()
        self.wait_for_mainloop_shutdown()

        self.assertTrue(self.mockUIPlug._display.called)
        self.assertIsNotNone(self.mainloop_thread)
        self.assertIsNotNone(self.display_thread)
        self.assertEqual(self.mainloop_thread, self.display_thread)
        self.assertTrue(self.time_display_call - now > 0.05)
コード例 #25
0
ファイル: test_ui.py プロジェクト: zz38/ubuntu-make
    def test_call_delayed_display(self, mocksys):
        """We call the display method from the UIPlug in delayed_display with 50ms waiting"""
        UI.delayed_display(self.contentType)
        now = time()
        self.start_glib_mainloop()
        self.wait_for_mainloop_shutdown()

        self.assertTrue(self.mockUIPlug._display.called)
        self.assertIsNotNone(self.mainloop_thread)
        self.assertIsNotNone(self.display_thread)
        self.assertEqual(self.mainloop_thread, self.display_thread)
        self.assertTrue(self.time_display_call - now > 0.05)
コード例 #26
0
ファイル: misc.py プロジェクト: mbkulik/umake-misc
    def decompress_and_install(self, fd):
        UI.display(DisplayMessage("Installing {}".format(self.name)))

        shutil.copyfile(fd.name, self.install_path + '/drjava.jar')

        self.post_install()

        # Mark as installation done in configuration
        self.mark_in_config()

        UI.delayed_display(DisplayMessage("Installation done"))
        UI.return_main_screen()
コード例 #27
0
ファイル: ide.py プロジェクト: jravetch/ubuntu-make
 def post_install(self):
     """Create the Arduino launcher"""
     icon_path = join(self.install_path, 'lib', 'arduino_icon.ico')
     comment = _("The Arduino Software IDE")
     categories = "Development;IDE;"
     create_launcher(self.desktop_filename,
                     get_application_desktop_file(name=_("Arduino"),
                                                  icon_path=icon_path,
                                                  exec='"{}" %f'.format(self.exec_path),
                                                  comment=comment,
                                                  categories=categories))
     if not self.was_in_arduino_group:
         UI.delayed_display(DisplayMessage(_("You need to logout and login again for your installation to work")))
コード例 #28
0
ファイル: rust.py プロジェクト: jravetch/ubuntu-make
    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)))
コード例 #29
0
ファイル: ide.py プロジェクト: shanenelson/ubuntu-make
 def post_install(self):
     """Create the Arduino launcher"""
     icon_path = join(self.install_path, 'lib', 'arduino_icon.ico')
     comment = _("The Arduino Software IDE")
     categories = "Development;IDE;"
     create_launcher(self.desktop_filename,
                     get_application_desktop_file(name=_("Arduino"),
                                                  icon_path=icon_path,
                                                  exec='"{}" %f'.format(self.exec_path),
                                                  comment=comment,
                                                  categories=categories))
     if not self.was_in_arduino_group:
         UI.delayed_display(DisplayMessage(_("You need to logout and login again for your installation to work")))
コード例 #30
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)))
コード例 #31
0
ファイル: web.py プロジェクト: pombredanne/ubuntu-make
    def get_metadata_and_check_license(self, result):
        """Diverge from the baseinstaller implementation in order to allow language selection"""

        logger.debug("Parse download metadata")
        error_msg = result[self.download_page].error
        if error_msg:
            logger.error("An error occurred while downloading {}: {}".format(self.download_page, error_msg))
            UI.return_main_screen(status_code=1)

        arch = platform.machine()
        arg_lang_url = None
        default_label = ''
        tag_machine = ''
        if arch == 'x86_64':
            tag_machine = '64'

        reg_expression = '<td class="download linux{}"><a href="(.*)" title'.format(tag_machine)
        languages = []
        decoded_page = result[self.download_page].buffer.getvalue().decode()
        for index, p in enumerate(re.finditer(reg_expression, decoded_page)):
            with suppress(AttributeError):
                url = p.group(1)

            m = re.search(r'lang=(.*)', url)
            with suppress(AttributeError):
                lang = m.group(1)

            if self.arg_lang and self.arg_lang.lower() == lang.lower():
                arg_lang_url = url
                break
            else:
                is_default_choice = False
                if lang == "en-US":
                    default_label = "(default: en-US)"
                    is_default_choice = True
                choice = Choice(index, lang, partial(self.language_select_callback, url), is_default=is_default_choice)
                languages.append(choice)

        if self.arg_lang:
            logger.debug("Selecting {} lang".format(self.arg_lang))
            if not arg_lang_url:
                logger.error("Could not find a download url for language {}".format(self.arg_lang))
                UI.return_main_screen(status_code=1)
            self.language_select_callback(arg_lang_url)
        else:
            if not languages:
                logger.error("Download page changed its syntax or is not parsable")
                UI.return_main_screen(status_code=1)
            logger.debug("Check list of installable languages.")
            UI.delayed_display(TextWithChoices(_("Choose language: {}".format(default_label)), languages, True))
コード例 #32
0
ファイル: rust.py プロジェクト: EdRondon/ubuntu-make
    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)))
コード例 #33
0
ファイル: android.py プロジェクト: ubuntu/ubuntu-make
    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")))
コード例 #34
0
ファイル: rust.py プロジェクト: ubuntu/ubuntu-make
    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)))
コード例 #35
0
ファイル: scala.py プロジェクト: fcole90/ubuntu-make
 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"
               )))
コード例 #36
0
    def decompress_and_install_done(self, result):
        self._install_done = True
        error_detected = False
        for fd in result:
            if result[fd].error:
                logger.error(result[fd].error)
                error_detected = True
            fd.close()
        if error_detected:
            UI.return_main_screen()

        self.post_install()

        # Mark as installation done in configuration
        self.mark_in_config()

        UI.delayed_display(DisplayMessage("Installation done"))
        UI.return_main_screen()
コード例 #37
0
    def decompress_and_install_done(self, result):
        self._install_done = True
        error_detected = False
        for fd in result:
            if result[fd].error:
                logger.error(result[fd].error)
                error_detected = True
            fd.close()
        if error_detected:
            UI.return_main_screen(status_code=1)

        self.post_install()

        # Mark as installation done in configuration
        self.mark_in_config()

        UI.delayed_display(DisplayMessage("Installation done"))
        UI.return_main_screen()
コード例 #38
0
ファイル: electronics.py プロジェクト: ubuntu/ubuntu-make
 def post_install(self):
     """Create the Arduino launcher"""
     icon_path = join(self.install_path, 'lib', 'arduino_icon.ico')
     comment = _("The Arduino Software IDE")
     categories = "Development;IDE;"
     create_launcher(self.desktop_filename,
                     get_application_desktop_file(name=_("Arduino"),
                                                  icon_path=icon_path,
                                                  try_exec=self.exec_path,
                                                  exec=self.exec_link_name,
                                                  comment=comment,
                                                  categories=categories))
     # add the user to arduino group
     if not self.was_in_arduino_group:
         with futures.ProcessPoolExecutor(max_workers=1) as executor:
             f = executor.submit(_add_to_group, self._current_user, self.ARDUINO_GROUP)
             if not f.result():
                 UI.return_main_screen(status_code=1)
         UI.delayed_display(DisplayMessage(_("You need to logout and login again for your installation to work")))
コード例 #39
0
ファイル: electronics.py プロジェクト: weblate/ubuntu-make
 def post_install(self):
     """Create the Arduino launcher"""
     icon_path = join(self.install_path, 'lib', 'arduino_icon.ico')
     comment = _("The Arduino Software IDE")
     categories = "Development;IDE;"
     create_launcher(self.desktop_filename,
                     get_application_desktop_file(name=_("Arduino"),
                                                  icon_path=icon_path,
                                                  try_exec=self.exec_path,
                                                  exec=self.exec_link_name,
                                                  comment=comment,
                                                  categories=categories))
     # add the user to arduino group
     if not self.was_in_arduino_group:
         with futures.ProcessPoolExecutor(max_workers=1) as executor:
             f = executor.submit(_add_to_group, self._current_user, self.ARDUINO_GROUP)
             if not f.result():
                 UI.return_main_screen(status_code=1)
         UI.delayed_display(DisplayMessage(_("You need to logout and login again for your installation to work")))
コード例 #40
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)))
コード例 #41
0
    def remove(self):
        """Remove current framework if installed

        Not that we only remove desktop file, launcher icon and dir content, we do not remove
        packages as they might be in used for other framework"""
        # check if it's installed and so on.
        super().remove()

        UI.display(DisplayMessage("Removing {}".format(self.name)))
        if self.desktop_filename:
            with suppress(FileNotFoundError):
                os.remove(get_launcher_path(self.desktop_filename))
        if self.icon_filename:
            with suppress(FileNotFoundError):
                os.remove(get_icon_path(self.icon_filename))
        with suppress(FileNotFoundError):
            shutil.rmtree(self.install_path)
        remove_framework_envs_from_user(self.name)
        self.remove_from_config()

        UI.delayed_display(DisplayMessage("Suppression done"))
        UI.return_main_screen()
コード例 #42
0
ファイル: test_ui.py プロジェクト: zz38/ubuntu-make
 def run_display(future):
     nonlocal now
     self.function_thread = threading.current_thread().ident
     now = time()
     UI.delayed_display(self.contentType)
コード例 #43
0
ファイル: test_ui.py プロジェクト: EdRondon/ubuntu-make
 def run_display(future):
     nonlocal now
     self.function_thread = threading.current_thread().ident
     now = time()
     UI.delayed_display(self.contentType)
コード例 #44
0
ファイル: go.py プロジェクト: pombredanne/ubuntu-make
 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)))
コード例 #45
0
ファイル: kotlin.py プロジェクト: EdRondon/ubuntu-make
 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)))
コード例 #46
0
ファイル: kotlin.py プロジェクト: jravetch/ubuntu-make
 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)))
コード例 #47
0
ファイル: android.py プロジェクト: ubuntu/ubuntu-make
 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)))
コード例 #48
0
ファイル: maven.py プロジェクト: ubuntu/ubuntu-make
 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)))
コード例 #49
0
ファイル: scala.py プロジェクト: pombredanne/ubuntu-make
 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)))
コード例 #50
0
ファイル: go.py プロジェクト: jravetch/ubuntu-make
 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)))