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 all 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
100 changes: 53 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,41 @@ 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
BINARY="./mne-extracted/main.pkg/Payload${MNE_INSTALL_PREFIX}/conda.exe"
echo "Checking ${BINARY} exists"
test -e "${BINARY}"
echo "Checking ${BINARY} is signed"
codesign -vd "${BINARY}"
echo "Checking entitlements of ${BINARY}"
codesign --display --entitlements - "${BINARY}"
rm -rf ./mne-extracted

- name: Notarize installer (macOS)
Expand Down Expand Up @@ -310,6 +304,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 +321,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 +333,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 +369,56 @@ 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
APP_DIR=/Applications/MNE-Python/${MNE_INSTALLER_VERSION}
[ `ls -ld ${APP_DIR} | 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 that the custom icon was set on the MNE folder in /Applications/MNE-Python"
echo "Checking we have all .app bundles in ${APP_DIR}:"
ls -al /Applications/
ls -al /Applications/MNE-Python
ls -al ${APP_DIR}
echo "Checking that there are 5 directories"
test `ls -d ${APP_DIR}/*.app | wc -l` -eq 5 || exit 1
echo "Checking that the custom icon was set on the MNE folder in ${APP_DIR}"
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__
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ Locally, installers can be built using `tools/build_local.sh`. Steps:
$ conda env create -f environment.yml
$ 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).
4. Install the environment for your platform.
5. Test it using the `tests/`.
2. Run `./tools/build_local.sh`.
3. Install the environment for your platform.
4. Test it using the `tests/`.
12 changes: 0 additions & 12 deletions assets/constructor_macOS_arm64.patch

This file was deleted.

101 changes: 0 additions & 101 deletions assets/constructor_macOS_common.patch

This file was deleted.

12 changes: 0 additions & 12 deletions assets/constructor_macOS_i386.patch

This file was deleted.

18 changes: 5 additions & 13 deletions assets/post_install_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,18 @@

# This script must be marked +x to work correctly with the installer!

# It works around a bug in menuinst.

set -e

echo "ℹ️ Fixing menu shortcuts."

cd "$HOME/.local/share/applications"
for f in ./MNE-Python*.desktop
do
sed -i "s/Terminal=True/Terminal=true/" $f
sed -i "s/Terminal=False/Terminal=false/" $f
done
set -eo pipefail

echo "ℹ️ Configuring Python to ignore user-installed local packages."
${PREFIX}/bin/conda env config vars set PYTHONNOUSERSITE=1

echo "ℹ️ Disabling mamba package manager banner."
${PREFIX}/bin/conda env config vars set MAMBA_NO_BANNER=1

echo "ℹ️ Pinning BLAS implementation to OpenBLAS"
echo "ℹ️ Setting libmama as the conda solver."
${PREFIX}/bin/conda config --set solver libmamba

echo "ℹ️ Pinning BLAS implementation to OpenBLAS."
echo "libblas=*=*openblas" >>${PREFIX}/conda-meta/pinned

echo "ℹ️ Running mne sys_info."
Expand Down
Loading