Skip to content
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

Write rights for all on cache file #25

Merged
merged 3 commits into from
Jan 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 6 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,19 @@ matrix:
- bash miniconda.sh -b -p $HOME/miniconda
- export PATH="$HOME/miniconda/bin:$PATH"
- source $HOME/miniconda/bin/activate
- name: "Windows Python 3.6"
os: windows
env: PYTHON_VERSION=3.6 DEPS="typing"
- name: "Xenial Linux Python 3.8"
env: PYTHON_VERSION=3.8 DEPS=""
before_install:
- choco install miniconda3
- . /c/tools/miniconda3/etc/profile.d/conda.sh
- wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
- bash miniconda.sh -b -p $HOME/miniconda
- export PATH="$HOME/miniconda/bin:$PATH"
- source $HOME/miniconda/bin/activate
- name: "Windows Python 3.7"
os: windows
env: PYTHON_VERSION=3.7 DEPS=""
before_install:
- choco install miniconda3
- . /c/tools/miniconda3/etc/profile.d/conda.sh
- name: "macOS Python 3.6"
os: osx
env: PYTHON_VERSION=3.6 DEPS="typing"
before_install:
- wget https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -O ~/miniconda.sh
- bash ~/miniconda.sh -b -p $HOME/miniconda
- export PATH="$HOME/miniconda/bin:$PATH"
- source $HOME/miniconda/bin/activate
- name: "macOS Python 3.7"
os: osx
env: PYTHON_VERSION=3.7 DEPS=""
Expand Down
12 changes: 9 additions & 3 deletions jupyter_conda/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import logging
import os
import re
import stat
import sys
import tempfile
import traceback
Expand Down Expand Up @@ -348,8 +349,8 @@ def get(self):
with open(cache_file) as cache:
cache_data = cache.read()
except OSError as e:
logger.warning(
"[jupyter_conda] Fail to load available packages from cache {!s}.".format(
logger.info(
"[jupyter_conda] No available packages list in cache {!s}.".format(
e
)
)
Expand All @@ -363,11 +364,16 @@ def update_available(
with open(cache_file, "w+") as cache:
json.dump(answer, cache)
except (ValueError, OSError) as e:
logger.warning(
logger.info(
"[jupyter_conda] Fail to cache available packages {!s}.".format(
e
)
)
else:
# Change rights to ensure every body can update the cache
os.chmod(
cache_file,
stat.S_IMODE(os.stat(cache_file).st_mode) | (stat.S_IWUSR | stat.S_IWGRP | stat.S_IWOTH))
PackagesHandler.__is_listing_available = False

if return_packages:
Expand Down
8 changes: 4 additions & 4 deletions jupyter_conda/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ def test_pkg_install_with_version_constraints(self):
r = self.wait_for_task(
self.conda_api.post,
["environments", n, "packages"],
body={"packages": [test_pkg + "==0.7.11"]},
body={"packages": [test_pkg + "==0.7.12"]},
)
self.assertEqual(r.status_code, 200)
r = self.conda_api.get(["environments", n])
Expand All @@ -490,7 +490,7 @@ def test_pkg_install_with_version_constraints(self):
if p["name"] == test_pkg:
v = p
break
self.assertEqual(v["version"], "0.7.11")
self.assertEqual(v["version"], "0.7.12")

n = generate_name()
self.wait_for_task(self.mk_env, n)
Expand All @@ -514,7 +514,7 @@ def test_pkg_install_with_version_constraints(self):
r = self.wait_for_task(
self.conda_api.post,
["environments", n, "packages"],
body={"packages": [test_pkg + ">=0.7.10,<0.7.12"]},
body={"packages": [test_pkg + ">=0.7.10,<0.7.13"]},
)
self.assertEqual(r.status_code, 200)
r = self.conda_api.get(["environments", n])
Expand All @@ -525,7 +525,7 @@ def test_pkg_install_with_version_constraints(self):
v = tuple(map(int, p["version"].split(".")))
break
self.assertGreaterEqual(v, (0, 7, 10))
self.assertLess(v, (0, 7, 12))
self.assertLess(v, (0, 7, 13))

def test_package_install_development_mode(self):
n = generate_name()
Expand Down