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

Bump to conda 23.11.0 (with menuinst v2) #36

Merged
merged 57 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
e10ec72
Require menuinst >=2
jaimergp Aug 21, 2023
02e8a96
use canary channel for menuinst
jaimergp Aug 21, 2023
5a9f29f
update sha
jaimergp Aug 22, 2023
60cc7fe
include alphas
jaimergp Aug 22, 2023
5ac360d
add news
jaimergp Aug 22, 2023
48f2c05
update imports and datas for menuinst
jaimergp Aug 22, 2023
8c630c1
use new menuinst api
jaimergp Aug 22, 2023
408dcc3
add test
jaimergp Aug 22, 2023
9ef8ffb
pre-commit
jaimergp Aug 22, 2023
43557ff
fix data path on windows
jaimergp Aug 22, 2023
1b3e8ba
pre-commit
jaimergp Aug 22, 2023
957ae23
fix exit codes
jaimergp Aug 22, 2023
c041187
refine test
jaimergp Aug 22, 2023
c45d273
refine test
jaimergp Aug 22, 2023
343ca65
pre-commit
jaimergp Aug 22, 2023
da559f9
Merge branch 'main' into menuinst-v2
jaimergp Sep 4, 2023
6cad423
update news
jaimergp Sep 4, 2023
42fdb7a
bump to conda 23.11 and cls 23.11.1
jaimergp Dec 12, 2023
05d2f4a
revert
jaimergp Dec 12, 2023
3e75998
update news
jaimergp Dec 12, 2023
8eb8fb5
Merge branch 'main' of github.com:conda/conda-standalone into menuins…
jaimergp Dec 12, 2023
210b0bc
update tests
jaimergp Dec 12, 2023
9665f4e
update hash
jaimergp Dec 12, 2023
0b7ccdb
simply gha workflow
jaimergp Dec 12, 2023
5b60c21
use 1.5.3
jaimergp Dec 12, 2023
b3b4a24
use python 3.10.13
jaimergp Dec 12, 2023
2a3fc3f
pin to conda-build 3.27?
jaimergp Dec 12, 2023
f8247af
Merge branch 'main' into menuinst-v2
jaimergp Dec 12, 2023
5a662a5
remove package name
jaimergp Dec 12, 2023
528a866
fix some paths
jaimergp Dec 12, 2023
4f6c8f6
paths must be str
jaimergp Dec 12, 2023
fbe60c1
adjust outdated docstring
jaimergp Dec 12, 2023
85ac540
update test reqs
jaimergp Dec 12, 2023
528a5ca
debug with prints
jaimergp Dec 12, 2023
8891573
verbosity
jaimergp Dec 12, 2023
32b65da
use needs_admin
jaimergp Dec 13, 2023
d556efb
require menuinst >=2 for tests
jaimergp Dec 13, 2023
b89ab42
invert
jaimergp Dec 13, 2023
6114f01
pre-commit
jaimergp Dec 13, 2023
f3e6035
try both locations because we can't know which one will be used for sure
jaimergp Dec 13, 2023
3b191b9
add comment
jaimergp Dec 13, 2023
bfeb7e6
debug with tmate
jaimergp Dec 14, 2023
48a4f9c
if always
jaimergp Dec 14, 2023
e70b7e0
v3
jaimergp Dec 14, 2023
b29d49b
debug earlier
jaimergp Dec 14, 2023
9f08097
retrigger
jaimergp Dec 14, 2023
95e99a8
retrigger
jaimergp Dec 14, 2023
9ba2451
retrigger
jaimergp Dec 14, 2023
f56962d
try different tests
jaimergp Dec 14, 2023
a00b655
use env in both calls
jaimergp Dec 14, 2023
ddc2421
remove tmate
jaimergp Dec 14, 2023
7df391e
use root-prefix in both
jaimergp Dec 14, 2023
2979d04
use env var instead
jaimergp Dec 14, 2023
7b2e7f8
Apply suggestions from code review
jaimergp Dec 17, 2023
1781a74
more p -> process
jaimergp Dec 17, 2023
c650ca1
Update .github/workflows/tests.yml
jezdez Dec 18, 2023
7996542
Update constructor's sha
jaimergp Dec 18, 2023
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
15 changes: 4 additions & 11 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,32 +29,25 @@ jobs:
include:
- os: ubuntu-latest
subdir: linux-64
python-version: "3.9"
- os: macos-latest
subdir: osx-64
python-version: "3.9"
- os: windows-latest
subdir: win-64
python-version: "3.9"
steps:
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2
with:
auto-activate-base: true
activate-environment: ""
miniforge-variant: Mambaforge
miniforge-version: latest
use-mamba: true
run-post: false
- name: Install conda-libmamba-solver

- name: Install dependencies
shell: bash -el {0}
run: |
mamba install "conda>=22.11.1" conda-libmamba-solver conda-build anaconda-client
conda update --all --solver=libmamba
run: conda install -y "conda-build!=3.28.0,!=3.28.1" anaconda-client

- name: Build recipe
shell: bash -el {0}
env:
CONDA_SOLVER: libmamba
CONDA_BLD_PATH: ${{ runner.temp }}/bld
run: conda build recipe

Expand Down
20 changes: 20 additions & 0 deletions news/36-update-menuinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
### Enhancements

* Bump to `python` 3.10.13, `conda` 23.11.0, `conda-libmamba-solver` 23.11.1 and `libmambapy` 1.5.3. (#36)
* Bundle `menuinst` v2.0.1 and import `menuinst` directly without relying on `constructor`'s `_nsis.py` module. (#36)

### Bug fixes

* <news item>

### Deprecations

* <news item>

### Docs

* <news item>

### Other

* <news item>
14 changes: 8 additions & 6 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{% set conda_version = "23.10.0" %}
{% set conda_libmamba_solver_version = "23.11.0" %}
{% set conda_version = "23.11.0" %}
{% set conda_libmamba_solver_version = "23.11.1" %}
{% set libmambapy_version = "1.5.3" %}
{% set constructor_version = "3.5.0" %}
{% set python_version = "3.9.15" %}
{% set python_version = "3.10.13" %}
{% set pyver = "".join(python_version.split(".")[:2]) %}

package:
Expand All @@ -11,16 +11,17 @@ package:

source:
- path: ../

- url: https://github.com/conda/conda/archive/{{ conda_version }}.tar.gz
sha256: 273d49db8ea723426b87866381daf2df27c7bca2c3474196460d637b62de2a1c
sha256: 9276686c8a6ee536dc451cc6557685724fe275a44949ac4f741066fd23cdc7b4
folder: conda_src
patches:
- ../src/conda_patches/0001-Rename-and-replace-entrypoint-stub-exe.patch
- ../src/conda_patches/0002-Manipulate-PATH-directly-instead-of-_call_ing-conda.patch
- ../src/conda_patches/0003-Return-unknown-module-in-deprecations.patch

- url: https://github.com/conda/constructor/archive/{{ constructor_version }}.tar.gz # [win]
sha256: 787ffd85e9414bdf70fe531f01eab3987a040e3f6a6ac3a01409f4d332f7de9e # [win]
sha256: 928ddd32942093a89563ef2eb3abb116be17795cf277545ea9f6e9a0a4ba7a17 # [win]
folder: constructor_src # [win]

build:
Expand All @@ -35,7 +36,7 @@ requirements:
- python ={{ python_version }}
- conda ={{ conda_version }}
- conda-package-handling >=1.6
- menuinst >=1.4.18,<2.0a0 # [win]
- menuinst >=2.0.1
- conda-libmamba-solver ={{ conda_libmamba_solver_version }}
- libmambapy ={{ libmambapy_version }}
run_constrained:
Expand All @@ -44,6 +45,7 @@ requirements:
test:
requires:
- pytest
- menuinst >=2
source_files:
- tests
commands:
Expand Down
25 changes: 20 additions & 5 deletions src/conda.exe.spec
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ else:

block_cipher = None
sitepackages = os.environ.get(
"SP_DIR", # site-packages in conda-build's host environment
"SP_DIR", # site-packages in conda-build's host environment
# if not defined, get running Python's site-packages
# Windows puts sys.prefix in this list first
next(
Expand All @@ -23,27 +23,42 @@ sitepackages = os.environ.get(
)
)


extra_exe_kwargs = {}
# Non imported files need to be added manually via datas or binaries:
# Datas are not analyzed, just copied over. Binaries go through some
# linkage analysis to also bring necessary libs. This includes plain
# text files like JSON, modules never imported, or standalone binaries
# Shared objects and DLLs should have been caught by pyinstaller import hooks,
# but if not, add them.
# Format: a list of tuples like (file-path, target-DIRECTORY)
binaries = []
datas = [
(os.path.join(sitepackages, 'archspec', 'json', 'COPYRIGHT'), 'archspec/json'),
(os.path.join(sitepackages, 'archspec', 'json', 'NOTICE'), 'archspec/json'),
(os.path.join(sitepackages, 'archspec', 'json', 'LICENSE-APACHE'), 'archspec/json'),
(os.path.join(sitepackages, 'archspec', 'json', 'LICENSE-MIT'), 'archspec/json'),
(os.path.join(sitepackages, 'archspec', 'json', 'cpu', 'microarchitectures.json'), 'archspec/json/cpu'),
(os.path.join(sitepackages, 'archspec', 'json', 'cpu', 'microarchitectures_schema.json'), 'archspec/json/cpu'),
(os.path.join(sitepackages, 'menuinst', 'data', 'menuinst.default.json'), 'menuinst/data'),
(os.path.join(sitepackages, 'menuinst', 'data', 'menuinst.schema.json'), 'menuinst/data'),
]
if sys.platform == "win32":
datas += [
(os.path.join(os.getcwd(), 'constructor_src', 'constructor', 'nsis', '_nsis.py'), 'Lib'),
(os.path.join(os.getcwd(), 'entry_point_base.exe'), '.')]

(os.path.join(os.getcwd(), 'entry_point_base.exe'), '.'),
]
elif sys.platform == "darwin":
datas += [
(os.path.join(sitepackages, 'menuinst', 'data', 'osx_launcher_arm64'), 'menuinst/data'),
(os.path.join(sitepackages, 'menuinst', 'data', 'osx_launcher_x86_64'), 'menuinst/data'),
(os.path.join(sitepackages, 'menuinst', 'data', 'appkit_launcher_arm64'), 'menuinst/data'),
(os.path.join(sitepackages, 'menuinst', 'data', 'appkit_launcher_x86_64'), 'menuinst/data'),
]
extra_exe_kwargs["entitlements_file"] = os.path.join(HERE, "entitlements.plist")

a = Analysis(['entry_point.py', 'imports.py'],
pathex=['.'],
binaries=[],
binaries=binaries,
datas=datas,
hiddenimports=['pkg_resources.py2_warn'],
hookspath=[],
Expand Down
33 changes: 8 additions & 25 deletions src/entry_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import os
import sys
from multiprocessing import freeze_support
from pathlib import Path


def _create_dummy_executor(*args, **kwargs):
Expand Down Expand Up @@ -169,23 +170,12 @@ def _constructor_extract_tarball():


def _constructor_menuinst(prefix, pkg_names=None, root_prefix=None, remove=False):
import importlib.util

root_prefix = root_prefix or prefix

utility_script = os.path.join(root_prefix, "Lib", "_nsis.py")
spec = importlib.util.spec_from_file_location("constructor_utils", utility_script)
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
if remove:
module.rm_menus(prefix=prefix, root_prefix=prefix)
elif pkg_names is not None:
module.mk_menus(
remove=False,
prefix=prefix,
pkg_names=pkg_names,
root_prefix=prefix,
)
from menuinst import install

for json_path in Path(prefix, "Menu").glob("*.json"):
if pkg_names and json_path.stem not in pkg_names:
continue
install(str(json_path), remove=remove, prefix=prefix, root_prefix=root_prefix)


def _constructor_subcommand():
Expand All @@ -196,9 +186,6 @@ def _constructor_subcommand():
- extract conda packages
- extract the tarball payload contained in the shell installers
- invoke menuinst to create and remove menu items on Windows

It is supported by a module included in `constructor`, `_nsis.py`, which is placed
in `$INSTDIR\Lib\_nsis.py` on Windows installations.
"""
args, _ = _constructor_parse_cli()
os.chdir(args.prefix)
Expand All @@ -212,10 +199,6 @@ def _constructor_subcommand():
# when called with --make-menus and no package names, the value is an empty list
# hence the explicit check for None
elif (args.make_menus is not None) or args.rm_menus:
if sys.platform != "win32":
raise NotImplementedError(
"Menu creation and removal is only supported on Windows"
)
Comment on lines -215 to -218
Copy link
Member

Choose a reason for hiding this comment

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

💥

_constructor_menuinst(
prefix=args.prefix,
pkg_names=args.make_menus,
Expand Down Expand Up @@ -292,7 +275,7 @@ def _conda_main():
from conda.cli import main

_fix_sys_path()
main()
return main()


def main():
Expand Down
31 changes: 30 additions & 1 deletion src/imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,15 @@
"conda_libmamba_solver",
"libmambapy",
]
site_packages = os.getenv("SP_DIR", site.getsitepackages()[0])
site_packages = os.environ.get(
"SP_DIR", # site-packages in conda-build's host environment
# if not defined, get running Python's site-packages
# Windows puts sys.prefix in this list first
next(
path for path in site.getsitepackages()
if path.endswith("site-packages")
)
)
files = [
f
for package in packages
Expand Down Expand Up @@ -263,7 +271,28 @@
import libmambapy.__init__
import libmambapy._version
import libmambapy.bindings
import menuinst.__init__

# import menuinst._schema
import menuinst.api
import menuinst.platforms.__init__
import menuinst.platforms.base
import menuinst.platforms.linux
import menuinst.platforms.osx
import menuinst.utils

if os.name == "nt":
import menuinst._legacy.__init__
import menuinst._legacy.cwp
import menuinst._legacy.main
import menuinst._legacy.utils
import menuinst._legacy.win32
import menuinst.platforms.win
import menuinst.platforms.win_utils.__init__
import menuinst.platforms.win_utils.knownfolders
import menuinst.platforms.win_utils.registry
import menuinst.platforms.win_utils.win_elevate
import menuinst.platforms.win_utils.winshortcut
try:
import conda_env.__main__
except Exception:
Expand Down
1 change: 1 addition & 0 deletions tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
pytest
menuinst>=2
Loading