-
Notifications
You must be signed in to change notification settings - Fork 190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add --update option #693
Merged
Merged
add --update option #693
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
9d78926
add --update option
NicolasKeita b412e55
Merge branch 'ubuntu:master' into master
NicolasKeita e7b3d36
remove duplicate code in each frameworks about '-update'
NicolasKeita 3b77df8
Refactor: Explicitly set updateability for certain frameworks
NicolasKeita ee53ec8
Add placeholder for tests about --update
NicolasKeita File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ | |
import pkgutil | ||
import sys | ||
import subprocess | ||
import re | ||
from umake.network.requirements_handler import RequirementsHandler | ||
from umake.settings import DEFAULT_INSTALL_TOOLS_PATH, UMAKE_FRAMEWORKS_ENVIRON_VARIABLE, DEFAULT_BINARY_LINK_PATH | ||
from umake.tools import ConfigHandler, NoneDict, classproperty, get_current_arch, get_current_distro_version,\ | ||
|
@@ -140,7 +141,7 @@ class BaseFramework(metaclass=abc.ABCMeta): | |
def __init__(self, name, description, category, force_loading=False, logo_path=None, is_category_default=False, | ||
install_path_dir=None, only_on_archs=None, only_ubuntu=False, only_ubuntu_version=None, | ||
packages_requirements=None, only_for_removal=False, expect_license=False, | ||
need_root_access=False, json=False, override_install_path=None): | ||
need_root_access=False, json=False, override_install_path=None, version_regex=None): | ||
self.name = name | ||
self.description = description | ||
self.logo_path = None | ||
|
@@ -153,6 +154,8 @@ def __init__(self, name, description, category, force_loading=False, logo_path=N | |
self.packages_requirements.extend(self.category.packages_requirements) | ||
self.only_for_removal = only_for_removal | ||
self.expect_license = expect_license | ||
self.version_regex = version_regex | ||
self.forbidden_to_update = False | ||
# self.override_install_path = "" if override_install_path is None else override_install_path | ||
|
||
# don't detect anything for completion mode (as we need to be quick), so avoid opening apt cache and detect | ||
|
@@ -331,6 +334,14 @@ def run_for(self, args): | |
auto_accept_license=auto_accept_license, | ||
dry_run=dry_run) | ||
|
||
def get_latest_version(self): | ||
return (re.search(self.version_regex, self.package_url).group(1).replace('_', '.') | ||
if self.package_url and self.version_regex else None) | ||
|
||
@staticmethod | ||
def get_current_user_version(install_path): | ||
return None | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding two default methods for each framework. |
||
|
||
class MainCategory(BaseCategory): | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was my way of preventing an update on some frameworks like Intellij.
Set by default at False then overridden in the class BaseJetBrains for example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would have used it the other way around, keeping the default as not updatable, and setting a framework to updatable explicitly. This way we only add information for those that have this functionality.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After thinking about it, I 100% agree with you. I have committed these changes 👍