Skip to content

Commit

Permalink
Merge pull request #302 from Anaconda-Platform/flagged-readonly
Browse files Browse the repository at this point in the history
Add support for .readonly file
  • Loading branch information
mcg1969 committed Dec 15, 2020
2 parents da724f5 + 58fdb1f commit 44dda4e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions anaconda_project/internal/default_conda_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ def _cache_directory(self, prefix):
def _test_writable_file(self, prefix):
return os.path.join(self._cache_directory(prefix), "status")

def _force_readonly_file(self, prefix):
return os.path.join(prefix, '.readonly')

def _timestamp_file(self, prefix, spec):
return os.path.join(self._cache_directory(prefix), "env-specs", spec.locked_hash)

Expand Down Expand Up @@ -193,6 +196,9 @@ def _write_a_file(self, filename):
return False

def _is_environment_writable(self, prefix):
filename = self._force_readonly_file(prefix)
if os.path.exists(filename):
return False
filename = self._test_writable_file(prefix)
return self._write_a_file(filename)

Expand Down

0 comments on commit 44dda4e

Please sign in to comment.