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

MAINT: Use bundle_tools_3 and fix various bugs #195

Merged
merged 64 commits into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from 57 commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
48ae61d
MAINT: Use bundle_tools_3
larsoner Jul 13, 2023
2930c71
FIX: No patch
larsoner Jul 13, 2023
0678ef9
WIP: Maybe?
larsoner Jul 13, 2023
38f5148
FIX: Wordpad
larsoner Jul 13, 2023
f378242
FIX: Again
larsoner Jul 13, 2023
7ad989e
Revert "FIX: Again"
larsoner Jul 13, 2023
b74eeee
FIX: NOT WIN
larsoner Jul 13, 2023
4938ecd
MAINT: Rerun and cruft
larsoner Jul 17, 2023
b959606
FIX: No patch
larsoner Jul 17, 2023
ca3fa25
FIX: Defaults
larsoner Jul 17, 2023
1afb4b3
FIX: SPacing
larsoner Jul 17, 2023
9fd2a61
FIX: Suggestion
larsoner Jul 17, 2023
0ab84f2
ENH: Notifications
larsoner Jul 17, 2023
ba344c9
FIX: Comment
larsoner Jul 17, 2023
b460387
FIX: Ver
larsoner Jul 17, 2023
a61e02d
FIX: Trim
larsoner Jul 17, 2023
158b171
FIX: Paths
larsoner Jul 17, 2023
00b07f0
FIX: Try again
larsoner Jul 18, 2023
60670a0
FIX: Tests
larsoner Jul 18, 2023
3a38d3f
FIX: Test
larsoner Jul 18, 2023
0b2c08f
FIX: Test
larsoner Jul 18, 2023
347d993
Merge branch 'main' into bt3
hoechenberger Jul 26, 2023
145c280
Merge remote-tracking branch 'upstream/main' into bt3
larsoner Aug 30, 2023
8b49f0c
FIX: Update
larsoner Aug 30, 2023
b78744f
FIX: Try here
larsoner Aug 30, 2023
8ecfc03
FIX: Install it
larsoner Aug 30, 2023
a86e052
FIX: Pin
larsoner Aug 30, 2023
5d7b1ea
WIP: Restore emoji
larsoner Aug 31, 2023
958f4c1
FIX: Spyder
larsoner Aug 31, 2023
844551f
WIP: Simplify macOS
larsoner Aug 31, 2023
f0a96e3
FIX: Back to library
larsoner Aug 31, 2023
fe8406f
FIX: Fixes for macOS
larsoner Aug 31, 2023
fe9e273
FIX: Path
larsoner Aug 31, 2023
d5927c3
FIX: Path
larsoner Aug 31, 2023
23a5813
FIX: More specific
larsoner Aug 31, 2023
7ce3af3
FIX: No longer needed
larsoner Aug 31, 2023
91c4567
FIX: CI
larsoner Aug 31, 2023
0bb99ec
FIX: Revert
larsoner Aug 31, 2023
85ae490
FIX: Revert
larsoner Aug 31, 2023
cbb43b6
FIX: Action
larsoner Aug 31, 2023
3bf2cea
FIX: environment.yml
larsoner Aug 31, 2023
f382e78
TST: Ping
larsoner Aug 31, 2023
6707055
FIX: Simplify
larsoner Aug 31, 2023
05474c7
FIX: Simplify more
larsoner Aug 31, 2023
1a51a10
FIX: Unify
larsoner Aug 31, 2023
356cc95
Update build.yml
larsoner Sep 1, 2023
f4a7d9e
Update post_install_windows.bat
larsoner Sep 1, 2023
4c5cce2
Update post_install_windows.bat
larsoner Sep 1, 2023
955fb7f
FIX: libmamba
larsoner Sep 1, 2023
67867d9
FIX: Workaround
larsoner Sep 1, 2023
c49ac77
FIX: Maybe
larsoner Sep 1, 2023
7019c7b
FIX: Maybe
larsoner Sep 1, 2023
e35f34b
FIX: Fixes
larsoner Sep 1, 2023
49223a5
FIX: Facilitate editable install
larsoner Sep 1, 2023
e595c16
FIX: Msg
larsoner Sep 1, 2023
483788a
FIX: Remove timeout
larsoner Sep 1, 2023
c5dfc2a
ENH: Menus here
larsoner Sep 1, 2023
ea00c68
Revert "ENH: Menus here"
larsoner Sep 1, 2023
961f550
Update assets/post_install_macOS.sh [ci skip]
larsoner Sep 1, 2023
b847b41
Merge branch 'main' into bt3
larsoner Sep 2, 2023
7f10d03
FIX: Nest
larsoner Sep 2, 2023
d9d2415
FIX: Whoops
larsoner Sep 2, 2023
ee224f6
ENH: Add development tools
larsoner Sep 5, 2023
5585a04
FIX: Versions
larsoner Sep 6, 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
95 changes: 48 additions & 47 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,13 @@ jobs:
- uses: actions/checkout@v3

- name: Install Micromamba
uses: mamba-org/provision-with-micromamba@main
uses: mamba-org/setup-micromamba@v1
with:
condarc: |
channels:
- conda-forge
channel_priority: strict
environment-file: environment.yml
micromamba-version: latest

- name: Hotfix for NSIS
run: |
mamba install nsis=3.01 conda=4.12a "pydantic<2.0a0"
if: ${{ runner.os == 'Windows' }}

- name: Extract version information
env:
Expand All @@ -135,45 +133,37 @@ jobs:
echo "MNE_INSTALLER_NAME=${MNE_INSTALLER_NAME}" >> $GITHUB_ENV
echo "MNE_INSTALLER_ARTIFACT_ID=${MNE_INSTALLER_ARTIFACT_ID}" >> $GITHUB_ENV
echo "RECIPE_DIR=${RECIPE_DIR}" >> $GITHUB_ENV
echo "CONDA_SOLVER=libmamba" >> $GITHUB_ENV
if [[ "$MNE_CROSSCOMPILE_ARCH" == "arm64" ]]; then
echo "PLATFORM_ARG=--platform=osx-arm64" >> $GITHUB_ENV
echo "EXE_ARG=--conda-exe=${CONDA_PREFIX}/standalone_conda/conda.exe" >> $GITHUB_ENV
fi

- name: Patch constructor
run: |
./tools/patch_constructor.sh

- name: Add macOS M1 support
if: ${{ matrix.arch == 'arm64' }}
run: |
source ./tools/setup_m1_crosscompile.sh
echo "EXE_ARG=${EXE_ARG}" >> $GITHUB_ENV
echo "PLATFORM_ARG=${PLATFORM_ARG}" >> $GITHUB_ENV

- name: Patch config (macOS pull request)
- name: Patch config (macOS non-PR)
if: ${{ runner.os == 'macOS' && github.event_name != 'pull_request' }}
run: |
sed -i "" "s/_name: *# \[osx\]/_name: 9779L28NP8 # \[osx\]/" ${RECIPE_DIR}/construct.yaml

- name: Build installer
# As of 2022/03/14, ~7 min on 20.04 (fastest) and ~11 min on windows-2019 (slowest).
# As of 2022/08/31, < 10 min on all platforms thanks to libmamba solver.
# So let's set this to a reasonable limit that will tell us more quickly
# if something has gone wrong with dependency resolution.
#
# Update 2022/06/03: Bump timeout as we're seeing sporadic issues on
# Linux
timeout-minutes: 50
timeout-minutes: 20
run: |
./tools/run_constructor.sh

- name: Check installer signature (macOS)
if: ${{ runner.os == 'macOS' && github.event_name != 'pull_request' }}
run: |
# Installer package
set -eo pipefail
pkgutil --check-signature ${MNE_INSTALLER_NAME}
# Now extract the package and check that the _conde.exe binary is
# Now extract the package and check that the conda.exe binary is
# properly signed as well
pkgutil --expand-full ${MNE_INSTALLER_NAME} ./mne-extracted
codesign -vd ./mne-extracted/main.pkg/Payload/.mne-python/_conda.exe
# Check entitlements of _conda.exe binary
codesign --display --entitlements - ./mne-extracted/main.pkg/Payload/.mne-python/_conda.exe
codesign -vd ./mne-extracted/main.pkg/Payload/Library/mne-python*/conda.exe
# Check entitlements of conda.exe binary
codesign --display --entitlements - ./mne-extracted/main.pkg/Payload/Library/mne-python*/conda.exe
rm -rf ./mne-extracted

- name: Notarize installer (macOS)
Expand Down Expand Up @@ -310,6 +300,8 @@ jobs:
echo "MNE_INSTALLER_VERSION=${MNE_INSTALLER_VERSION}"
echo "MNE_ACTIVATE=${MNE_ACTIVATE}" >> $GITHUB_ENV
echo "MNE_ACTIVATE=${MNE_ACTIVATE}"
echo "MNE_INSTALL_PREFIX=$MNE_INSTALL_PREFIX" >> $GITHUB_ENV
echo "NSIS_SCRIPTS_RAISE_ERRORS=1" >> $GITHUB_ENV

- name: Download appropriate installer
uses: actions/download-artifact@v3
Expand All @@ -325,10 +317,7 @@ jobs:
- name: Run installer (macOS Intel)
if: ${{ runner.os == 'macOS' && matrix.arch == 'x86_64' }}
run: |
sudo installer \
-verbose \
-pkg ${MNE_INSTALLER_NAME} \
-target / \
sudo installer -verbose -pkg ${MNE_INSTALLER_NAME} -target / \
|| ( tail -n 30 /var/log/install.log && exit 1 ) # display last log messages on error

- name: Run installer (Linux)
Expand All @@ -340,7 +329,7 @@ jobs:
# https://docs.anaconda.com/anaconda/install/silent-mode.html#windows
- name: Run installer (Windows)
if: ${{ runner.os == 'Windows' }}
timeout-minutes: 20
timeout-minutes: 30
shell: cmd
run: |
.\%MNE_INSTALLER_NAME% /S /InstallationType=JustMe /AddToPath=1
Expand Down Expand Up @@ -376,43 +365,55 @@ jobs:
- name: Check installation
if: ${{ matrix.arch == 'x86_64' }}
run: |
set -eo pipefail
source "${MNE_ACTIVATE}"
conda info
mamba list

if [[ "${{ runner.os }}" == "macOS" ]]; then
echo "Testing that file permissions are set correctly (owned by "runner", not "root".)"
echo "Testing that file permissions are set correctly (owned by "$USER", not "root".)"
# https://unix.stackexchange.com/a/7733
[ `ls -ld /Applications/MNE-Python/.mne-python | awk 'NR==1 {print $3}'` == "runner" ] || exit 1
# Check that the installed Python is, in fact, an Intel binary
[ `ls -ld /Applications/MNE-Python*/ | awk 'NR==1 {print $3}'` == "$USER" ] || exit 1
[ `ls -ld /Library/mne-python*/ | awk 'NR==1 {print $3}'` == "$USER" ] || exit 1
echo "Check that the installed Python is, in fact, an Intel binary"
python -c "import platform; assert platform.machine() == 'x86_64'" || exit 1
echo "Checking we have all .app bundles in /Applications/MNE-Python:"
ls -d /Applications/MNE-Python/*.app || exit 1
test `ls -d /Applications/MNE-Python/*.app | wc -l` -eq 5 || exit 1
echo "Checking we have all .app bundles in /Applications:"
ls -al /Applications/
ls -d /Applications/MNE-Python*/*.app || exit 1
echo "Checking that there are 5 directories"
test `ls -d /Applications/MNE-Python*/*.app | wc -l` -eq 5 || exit 1
echo "Checking that the custom icon was set on the MNE folder in /Applications/MNE-Python"
test -f /Applications/MNE-Python/Icon$'\r' || exit 1
test -f /Applications/MNE-Python*/Icon$'\r' || exit 1
elif [[ "${{ runner.os }}" == "Linux" ]]; then
echo "Checking that menu shortcuts were created …"
pushd ~/.local/share/applications
ls -l || exit 1
echo "Checking for existence of .desktop files:"
ls MNE-Python*.desktop || exit 1
test `ls MNE-Python*.desktop | wc -l` -eq 5 || exit 1
ls mne-python*.desktop || exit 1
test `ls mne-python*.desktop | wc -l` -eq 5 || exit 1
echo ""

# … and patched to work around a bug in menuinst
echo "Checking that incorrect Terminal entries have been removed"
test `grep "Terminal=True" MNE-Python*.desktop | wc -l` -eq 0 || exit 1
test `grep "Terminal=False" MNE-Python*.desktop | wc -l` -eq 0 || exit 1
test `grep "Terminal=True" mne-python*.desktop | wc -l` -eq 0 || exit 1
test `grep "Terminal=False" mne-python*.desktop | wc -l` -eq 0 || exit 1
echo ""

echo "Checking that Terminal entries are correct…"
test `grep "Terminal=true" MNE-Python*.desktop | wc -l` -ge 1 || exit 1
test `grep "Terminal=false" MNE-Python*.desktop | wc -l` -ge 1 || exit 1
test `grep "Terminal=true" mne-python*.desktop | wc -l` -ge 1 || exit 1
test `grep "Terminal=false" mne-python*.desktop | wc -l` -ge 1 || exit 1
# Display their contents
for f in MNE-Python*.desktop; do echo "📂 $f:"; cat "$f"; echo; done
for f in mne-python*.desktop; do echo "📂 $f:"; cat "$f"; echo; done
popd
fi
echo "Checking for pinned file..."
test -e "$MNE_INSTALL_PREFIX/conda-meta/pinned"
grep "openblas" "$MNE_INSTALL_PREFIX/conda-meta/pinned"

echo "Checking permissions..."
OWNER=`ls -ld "$(which python)" | awk '{print $3}'`
echo "Got OWNER=$OWNER, should be $(whoami)"
test "$OWNER" == "$(whoami)"

echo "Checking whether (Py)Qt is working"
LD_DEBUG=libs python -c "from PyQt5.QtWidgets import QApplication, QWidget; app = QApplication([])"
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ tests/test.png
.vscode
.pytest_cache
.DS_Store
__pycache__
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ Locally, installers can be built using `tools/build_local.sh`. Steps:
$ conda activate constructor-env
```
2. If you want to build an arm64 (M1) package on a macOS Intel machine, run `source ./tools/setup_m1_crosscompile.sh`.
3. Run `./tools/build_local.sh` (which will patch the constructor on macOS if needed).
3. Run `./tools/build_local.sh`.
4. Install the environment for your platform.
5. Test it using the `tests/`.
168 changes: 168 additions & 0 deletions assets/Menu/mne.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
{
"$schema": "https://json-schema.org/draft-07/schema",
"$id": "https://schemas.conda.io/menuinst-1.schema.json",
"menu_name": "MNE-Python (1.5.0)",
"menu_items": [{
"name": "Spyder (MNE)",
"description": "The Spyder development environment",
"icon": "{{ MENU_DIR }}/mne_spyder.{{ ICON_EXT }}",
"command": ["will be overridden in platforms section"],
"activate": true,
"terminal": false,
"platforms": {
"win": {
"command": [
"{{ PYTHONW }}",
"{{ SCRIPTS_DIR }}\\spyder-script.py"
],
"desktop": false
},
"linux": {
"command": ["spyder"],
"Categories": [
"Science"
]
},
"osx": {
"command": ["spyder"],
"CFBundleName": "Spyder (MNE-Python 1.5.0)",
"CFBundleDisplayName": "Spyder (MNE-Python 1.5.0)",
"CFBundleVersion": "1.5.0"
}
}
},
{
"name": "System Info (MNE)",
"description": "Information on the MNE-Python runtime environment",
"icon": "{{ MENU_DIR }}/mne_info.{{ ICON_EXT }}",
"command": [
"{{ PYTHON }}",
"{{ MENU_DIR }}/mne_sys_info.py"
],
"activate": true,
"terminal": true,
"platforms": {
"win": {
"desktop": false
},
"linux": {
"Categories": [
"Science"
]
},
"osx": {
"CFBundleName": "System Information (MNE-Python 1.5.0)",
"CFBundleDisplayName": "System Information (MNE-Python 1.5.0)",
"CFBundleVersion": "1.5.0"
}
}
},
{
"name": "Prompt (MNE)",
"description": "MNE-Python console prompt",
"icon": "{{ MENU_DIR }}/mne_console.{{ ICON_EXT }}",
"activate": true,
"terminal": true,
"command": ["will be overridden in platforms section"],
"platforms": {
"win": {
"command": [
"%SystemRoot%\\system32\\cmd.exe",
"/K",
"{{ MENU_DIR }}\\mne_open_prompt.bat"
],
"desktop": false
},
"linux": {
"command": [
"exec",
"bash",
"--init-file",
"{{ MENU_DIR }}/mne_open_prompt.sh"
],
"Categories": [
"Science"
]
},
"osx": {
"command": [
"osascript",
"{{ MENU_DIR }}/mne_open_prompt.applescript"
],
"CFBundleName": "Prompt (MNE-Python 1.5.0)",
"CFBundleDisplayName": "Prompt (MNE-Python 1.5.0)",
"CFBundleVersion": "1.5.0"
}
}
},
{
"name": "Tutorials (MNE)",
"description": "MNE-Python online tutorials",
"icon": "{{ MENU_DIR }}/mne_web.{{ ICON_EXT }}",
"activate": false,
"terminal": false,
"command": ["will be overridden in platforms section"],
"platforms": {
"win": {
"command": [
"%SystemRoot%\\system32\\WindowsPowerShell\\v1.0\\powershell.exe",
"\"start https://mne.tools/stable/auto_tutorials -WindowStyle hidden\""
],
"desktop": false
},
"linux": {
"command": [
"xdg-open",
"https://mne.tools/stable/auto_tutorials/"
],
"Categories": [
"Science"
]
},
"osx": {
"command": [
"open",
"https://mne.tools/stable/auto_tutorials/"
],
"CFBundleName": "Tutorials (MNE-Python 1.5.0)",
"CFBundleDisplayName": "Tutorials (MNE-Python 1.5.0)",
"CFBundleVersion": "1.5.0"
}
}
},
{
"name": "User Forum (MNE)",
"description": "MNE-Python forum for discussions, problem solving, and information exchange",
"icon": "{{ MENU_DIR }}/mne_forum.{{ ICON_EXT }}",
"activate": false,
"terminal": false,
"command": ["will be overridden in platforms section"],
"platforms": {
"win": {
"command": [
"%SystemRoot%\\system32\\WindowsPowerShell\\v1.0\\powershell.exe",
"\"start https://mne.discourse.group -WindowStyle hidden\""
],
"desktop": false
},
"linux": {
"command": [
"xdg-open",
"https://mne.discourse.group"
],
"Categories": [
"Science"
]
},
"osx": {
"command": [
"open",
"https://mne.discourse.group"
],
"CFBundleName": "Forum (MNE-Python 1.5.0)",
"CFBundleDisplayName": "Forum (MNE-Python 1.5.0)",
"CFBundleVersion": "1.5.0"
}
}
}]
}
Binary file added assets/Menu/mne.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/Menu/mne_console.icns
Binary file not shown.
Binary file added assets/Menu/mne_console.ico
Binary file not shown.
Binary file added assets/Menu/mne_console.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/Menu/mne_forum.icns
Binary file not shown.
Binary file added assets/Menu/mne_forum.ico
Binary file not shown.
Binary file added assets/Menu/mne_forum.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/Menu/mne_info.icns
Binary file not shown.
Binary file added assets/Menu/mne_info.ico
Binary file not shown.
Binary file added assets/Menu/mne_info.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions assets/Menu/mne_open_prompt.applescript
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
tell application "Terminal"
do script "source /home/conda/feedstock_root/build_artifacts/mne-python_1692127656949/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_/Menu/mne_open_prompt.sh"
activate
end tell
10 changes: 10 additions & 0 deletions assets/Menu/mne_open_prompt.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
:: This is used to initialize the bash prompt on Windows.
@ECHO OFF

call %/home/conda/feedstock_root/build_artifacts/mne-python_1692127656949/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_%\Scripts\Activate.bat
Copy link
Member Author

Choose a reason for hiding this comment

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

This makes me think that the hack of doing menuinst ourselves will not work. Either menuinst or constructor must do something magical here. I'll revert for now but c5dfc2a seems close to what we want

FOR /F "tokens=*" %%g IN ('python --version') do (SET PYVER=%%g)
FOR /F "tokens=*" %%g IN ('where python') do (SET PYPATH=%%g)
FOR /F "tokens=*" %%g IN ('mne --version') do (SET MNEVER=%%g)

ECHO Using %PYVER% from %PYPATH%
ECHO This is %MNEVER%
10 changes: 10 additions & 0 deletions assets/Menu/mne_open_prompt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

# This is used to initialize the bash prompt on macOS and Linux.

if [[ -f ~/.bashrc ]] && [[ ${OSTYPE} != 'darwin'* ]]; then
source ~/.bashrc
fi
source /home/conda/feedstock_root/build_artifacts/mne-python_1692127656949/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_/bin/activate
echo "Using $(python --version) from $(which python)"
echo "This is $(mne --version)"
Binary file added assets/Menu/mne_spyder.icns
Binary file not shown.
Binary file added assets/Menu/mne_spyder.ico
Binary file not shown.
Binary file added assets/Menu/mne_spyder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading