-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add better heuristic for build detection #2773
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
f4ee4b0
Add better heuristic for build detection
e1dfb75
Refactor get_package_manager
36f75dd
Remove unnecessary file
c48c842
remove patches in favor of echo
4fdf269
fix dvc build path
c68adc9
remove windows patch in favor of echo
707cce9
remove unnecessary line
a0efedc
remove arch support from readme
1156763
add pip fallback
172ad71
fix typo
3ba4b8b
remove unnecessary pip check
448ae95
fix windows echo
53f4ad2
add build cleanup
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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,63 +1,4 @@ | ||
| from dvc.utils import is_binary | ||
|
|
||
|
|
||
| def is_conda(): | ||
| try: | ||
| from .build import PKG # patched during conda package build | ||
|
|
||
| return PKG == "conda" | ||
| except ImportError: | ||
| return False | ||
|
|
||
|
|
||
| def get_linux(): | ||
| import distro | ||
|
|
||
| if not is_binary(): | ||
| return "pip" | ||
|
|
||
| package_managers = { | ||
| "rhel": "yum", | ||
| "centos": "yum", | ||
| "fedora": "yum", | ||
| "amazon": "yum", | ||
| "opensuse": "yum", | ||
| "ubuntu": "apt", | ||
| "debian": "apt", | ||
| } | ||
|
|
||
| return package_managers.get(distro.id()) | ||
|
|
||
|
|
||
| def get_darwin(): | ||
| if not is_binary(): | ||
| if __file__.startswith("/usr/local/Cellar"): | ||
| return "formula" | ||
| else: | ||
| return "pip" | ||
| return None | ||
|
|
||
|
|
||
| def get_windows(): | ||
| return None if is_binary() else "pip" | ||
|
|
||
|
|
||
| def get_package_manager(): | ||
| import platform | ||
| from dvc.exceptions import DvcException | ||
|
|
||
| if is_conda(): | ||
| return "conda" | ||
|
|
||
| m = { | ||
| "Windows": get_windows(), | ||
| "Darwin": get_darwin(), | ||
| "Linux": get_linux(), | ||
| } | ||
|
|
||
| system = platform.system() | ||
| func = m.get(system) | ||
| if func is None: | ||
| raise DvcException("not supported system '{}'".format(system)) | ||
|
|
||
| return func | ||
| try: | ||
| from .build import PKG # file created during dvc build | ||
| except ImportError: | ||
| PKG = None |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
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.
Uh oh!
There was an error while loading. Please reload this page.