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

fix conda 23.1+ incompatibility #659

Merged
merged 6 commits into from
Apr 21, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion conda.recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ requirements:
# FIXME: Workaround for xz 5.2.10 issue on py310
- xz !=5.2.10 # [win and py == 310]
run:
- conda >=4.6,<23.1.0
- conda >=4.6
- python
- ruamel_yaml >=0.11.14,<0.16
- conda-standalone
jaimergp marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
9 changes: 6 additions & 3 deletions constructor/conda_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,17 +146,17 @@ def write_repodata(cache_dir, url, full_repodata, used_packages, info):
data["md5"] = hash_files([pkg_fn])
used_repodata[key][package] = data

# The first line of the JSON should contain cache metadata
# In conda <23.1, the first line of the JSON should contain cache metadata
# Choose an arbitrary old, expired date, so that conda will want to
# immediately update it when not being run in offline mode
url = used_repodata.pop('_url').rstrip("/")
repodata_url = used_repodata.pop('_url', url).rstrip("/")
used_repodata.pop("_mod", None)
repodata = json.dumps(used_repodata, indent=2)
mod_time = "Mon, 07 Jan 2019 15:22:15 GMT"
repodata_header = json.dumps(
{
"_mod": mod_time,
"_url": url,
"_url": repodata_url,
}
)
repodata = repodata_header[:-1] + "," + repodata[1:]
Expand All @@ -171,6 +171,9 @@ def write_repodata(cache_dir, url, full_repodata, used_packages, info):
mod_time_s = int(mod_time_datetime.timestamp())
os.utime(repodata_filepath, times=(mod_time_s, mod_time_s))

# TODO: write the state.json file, for conda >23.1
# Maybe it's not needed anymore.
Comment on lines +174 to +175
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only relevant when conda-standalone 23.* becomes available.


def write_cache_dir():
cache_dir = join(PackageCacheData.first_writable().pkgs_dir, 'cache')
mkdir_p_sudo_safe(cache_dir)
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
"console_scripts": ["constructor = constructor.main:main"],
},
install_requires=[
"conda >=4.6,<23.1.0",
"conda >=4.6",
"ruamel_yaml",
"pillow >=3.1 ; platform_system=='Windows' or platform_system=='Darwin'",
# non-python dependency: "nsis >=3.01 ; platform_system=='Windows'",
# non-python dependency: "nsis >=3.08 ; platform_system=='Windows'",
],
# We could differentiate between operating systems here but that is
# far more trouble than it is worth
Expand Down