mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-10 07:18:27 +01:00
add pip fallback
This commit is contained in:
+4
-2
@@ -124,12 +124,12 @@ class Updater(object): # pragma: no cover
|
||||
instructions = {
|
||||
"pip": "Run {yellow}pip{reset} install dvc {blue}--upgrade{reset}",
|
||||
"rpm": "Run {yellow}yum{reset} update dvc",
|
||||
"osxpkg": "Run {yellow}brew{reset} upgrade dvc",
|
||||
"brew": "Run {yellow}brew{reset} upgrade dvc",
|
||||
"deb": (
|
||||
"Run {yellow}apt-get{reset} install"
|
||||
" {blue}--only-upgrade{reset} dvc"
|
||||
),
|
||||
"exe": (
|
||||
"binary": (
|
||||
"To upgrade follow these steps:\n"
|
||||
"1. Uninstall dvc binary\n"
|
||||
"2. Go to {blue}https://dvc.org{reset}\n"
|
||||
@@ -144,5 +144,7 @@ class Updater(object): # pragma: no cover
|
||||
}
|
||||
|
||||
package_manager = get_package_manager()
|
||||
if package_manager in ("osxpkg", "exe"):
|
||||
package_manager = "binary"
|
||||
|
||||
return instructions[package_manager]
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ from dvc.utils import is_binary
|
||||
|
||||
def check_build_patch():
|
||||
try:
|
||||
from .build import PKG # patched during conda package build
|
||||
from .build import PKG # file created during dvc build
|
||||
|
||||
return PKG
|
||||
except ImportError:
|
||||
|
||||
@@ -8,6 +8,8 @@ if [ ! -d "dvc" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "PKG = \"pip\"" > dvc/utils/build.py
|
||||
|
||||
python setup.py sdist
|
||||
python setup.py bdist_wheel --universal
|
||||
|
||||
|
||||
+10
-5
@@ -51,7 +51,6 @@ command_exists()
|
||||
|
||||
fpm_build()
|
||||
{
|
||||
echo "PKG = \"$1\"" > $(pwd)/dvc/utils/build.py
|
||||
print_info "Building $1..."
|
||||
VERSION=$(python -c "import dvc; from dvc import __version__; print(str(__version__))")
|
||||
fpm -s dir \
|
||||
@@ -132,15 +131,21 @@ build_dvc()
|
||||
fi
|
||||
}
|
||||
|
||||
build()
|
||||
{
|
||||
echo "PKG = \"$1\"" > dvc/utils/build.py
|
||||
build_dvc
|
||||
fpm_build $1
|
||||
}
|
||||
|
||||
cleanup
|
||||
install_dependencies
|
||||
build_dvc
|
||||
|
||||
if [[ "$(uname)" == 'Linux' ]]; then
|
||||
fpm_build rpm
|
||||
fpm_build deb
|
||||
build rpm
|
||||
build deb
|
||||
else
|
||||
fpm_build osxpkg
|
||||
build osxpkg
|
||||
fi
|
||||
|
||||
cleanup
|
||||
|
||||
@@ -50,13 +50,3 @@ def test_check_version_outdated(updater):
|
||||
updater.current = "0.20.8"
|
||||
|
||||
assert updater._is_outdated()
|
||||
|
||||
|
||||
@mock.patch("dvc.utils.pkg.is_conda")
|
||||
def test_check_dvc_from_conda(mocked_is_conda, updater):
|
||||
mocked_is_conda.return_value = True
|
||||
updater.latest = "0.21.0"
|
||||
updater.current = "0.20.8"
|
||||
|
||||
msg = "Run {yellow}conda{reset} {update}update{reset} dvc"
|
||||
assert updater._get_update_instructions() == msg
|
||||
|
||||
@@ -10,14 +10,13 @@ def test_info_in_repo(repo_dir, dvc_repo, caplog):
|
||||
# adding a file so that dvc creates `.dvc/cache`, that is needed for proper
|
||||
# supported link types check.
|
||||
assert main(["add", repo_dir.FOO]) == 0
|
||||
|
||||
assert main(["version"]) == 0
|
||||
|
||||
assert re.search(re.compile(r"DVC version: \d+\.\d+\.\d+"), caplog.text)
|
||||
assert re.search(re.compile(r"Python version: \d\.\d\.\d"), caplog.text)
|
||||
assert re.search(re.compile(r"Platform: .*"), caplog.text)
|
||||
assert re.search(re.compile(r"Binary: (True|False)"), caplog.text)
|
||||
assert re.search(re.compile(r"Package manager: .*"), caplog.text)
|
||||
assert re.search(re.compile(r"Package type: .*"), caplog.text)
|
||||
assert re.search(
|
||||
re.compile(r"(Cache: (.*link - (True|False)(,\s)?){3})"), caplog.text
|
||||
)
|
||||
@@ -42,7 +41,7 @@ def test_info_outside_of_repo(repo_dir, caplog):
|
||||
assert re.search(re.compile(r"Python version: \d\.\d\.\d"), caplog.text)
|
||||
assert re.search(re.compile(r"Platform: .*"), caplog.text)
|
||||
assert re.search(re.compile(r"Binary: (True|False)"), caplog.text)
|
||||
assert re.search(re.compile(r"Package manager: .*"), caplog.text)
|
||||
assert re.search(re.compile(r"Package type: .*"), caplog.text)
|
||||
assert not re.search(
|
||||
re.compile(r"(Cache: (.*link - (True|False)(,\s)?){3})"), caplog.text
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user