33# Exit on error, unset variable, or pipe failure
44set -euo pipefail
55
6- # This will be empty for nightly test, and we will clone master branch
7- FLUX_RELEASE_VERSION=${FLUX_RELEASE_VERSION:- 0.78.0}
8- FLUX_VERSION=${FLUX_VERSION:- 0.78.0}
6+ # This must be set
7+ PYTHON_VERSION=${1:- py311}
8+
9+ # These will be empty for nightly test, and we will clone master branch
10+ FLUX_RELEASE_VERSION=${2:- 0.78.0}
11+ FLUX_VERSION=${3:- 0.78.0}
912
1013if [[ " $( uname) " == " Darwin" ]]; then
1114 brew install \
1215 autoconf \
1316 automake \
17+ epoll-shim \
1418 libtool \
1519 make \
1620 pkg-config \
17- epoll-shim \
1821 libev \
1922 zeromq \
2023 jansson \
21- lz4 \
22- libarchive \
23- hwloc \
24- sqlite \
25- lua \
26- luarocks \
27- cffi \
28- libyaml \
29- jq
24+ hwloc
3025
3126 # Possibility - install munge with MacPorts
3227 # sudo port install munge
33- eval " $( /opt/homebrew/bin/brew shellenv) "
28+ # eval "$(/opt/homebrew/bin/brew shellenv)"
3429
3530 # Set the dynamic library path variable for macOS
36- export DYLD_LIBRARY_PATH=/usr/local/lib
37-
31+ # export DYLD_LIBRARY_PATH=/usr/local/lib
32+
3833 # Ensure we activate micromamabe that has a pinned version
39- PIP_INSTALL=" /opt/conda/bin/python3 -m pip install"
40- ln -s $( which glibtoolize) /usr/local/bin/libtoolize
34+ # ln -s $(which glibtoolize) /usr/local/bin/libtoolize
4135
42- CPPFLAGS=" -I${HOMEBREW_PREFIX} /include/lua"
43- CPPFLAGS=" -I$( brew --prefix libev) /include ${CPPFLAGS} "
44- CPPFLAGS=" -I$( brew --prefix epoll-shim) /include/libepoll-shim ${CPPFLAGS} "
45- # LDFLAGS=-L${HOMEBREW_PREFIX}/lib
46- PKG_CONFIG_PATH=$( pkg-config --variable pc_path pkg-config)
47- PKG_CONFIG_PATH=$( brew --prefix libarchive) /lib/pkgconfig:${PKG_CONFIG_PATH}
48- PATH=$( brew --prefix libtool) /libexec/gnubin:$PATH
49- export LD_LIBRARY_PATH=" /opt/conda/envs/build/lib:/opt/conda/envs/build/lib64"
36+ # CPPFLAGS="-I${HOMEBREW_PREFIX}/include/lua"
37+ # CPPFLAGS="-I$(brew --prefix libev)/include ${CPPFLAGS}"
38+ # CPPFLAGS="-I$(brew --prefix epoll-shim)/include/libepoll-shim ${CPPFLAGS}"
39+
40+ # PKG_CONFIG_PATH=$(pkg-config --variable pc_path pkg-config)
41+ # PKG_CONFIG_PATH=$(brew --prefix libarchive)/lib/pkgconfig:${PKG_CONFIG_PATH}
42+ # PATH=$(brew --prefix libtool)/libexec/gnubin:$PATH
5043
5144# Linux block!
5245else
7669 libs3-dev \
7770 libevent-dev \
7871 libarchive-dev \
79- python3-sphinx \
80- python3-cffi \
8172 libtool \
8273 git \
8374 build-essential \
8677 sudo rm -rf /var/lib/apt/lists/*
8778 sudo ldconfig
8879
89- # Set the dynamic library path variable for Linux. The conda path is for the container.
90- export LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/opt/conda/envs/build/lib
80+ # Set the dynamic library path variable for Linux.
81+ export LD_LIBRARY_PATH=/usr/local/lib:/usr/lib
82+ echo " LD_LIBRARY_PATH: ${LD_LIBRARY_PATH} "
9183fi
9284
93- # Ensure we find micromamba environment first
94- # mamba init commands are intolerable so let's do basics ourselves.
95- PIP_INSTALL=" /opt/conda/envs/build/bin/python3 -m pip install"
96- export PATH=" /opt/conda/envs/build/bin:$PATH "
97- export PYTHONPATH=$( find /opt/conda/envs/build -name site-packages)
98- export PYTHON=/opt/conda/envs/build/bin/python3
99- export PYTHON_PREFIX=${PYTHONPATH}
100- export PYTHON_EXEC_PREFIX=${PYTHONPATH}
101- # export LIBS="-L/opt/conda/envs/build/lib:/opt/conda/envs/build/lib64"
102-
10385echo " Found Python $( which python3) "
104- echo " PYTHONPATH: ${PATH} "
10586echo " PATH: ${PATH} "
106- echo " LD_LIBRARY_PATH: ${LD_LIBRARY_PATH} "
10787
10888# Here we can start common setup (we hope)
10989echo " Flux Version for pypi is ${FLUX_VERSION} "
11090if [[ " $( uname) " == " Darwin" ]]; then
91+ PIXI_ROOT=/Users/runner/work/flux-python/flux-python/.pixi
92+ PIXI_ENV=${PIXI_ROOT} /envs/${PYTHON_VERSION}
11193 sed -i ' ' " s/package_version = \" develop\" /package_version = \" $FLUX_VERSION \" /" setup.py
94+ echo $( find /Users/runner/ -name python3) || echo $( find /Users/runner/ -name python)
95+
96+ # Tell where to look for lua.h
97+ CPPFLAGS=" -I${PIXI_ENV} /include ${CPPFLAGS} "
98+
99+ # This makes me want to kill homebrew and MacOS with fire.
100+ # I know most of these aren't required. I can't remove them because of the ❤️🔥
101+ export PYTHON_SITE_PACKAGES=$( find ${PIXI_ENV} -name site-packages)
102+ export PYTHON_EXEC_PREFIX=${PYTHON_SITE_PACKAGES}
103+ export PYTHON_SITE_PKG=${PYTHON_SITE_PACKAGES}
104+ export PYTHON_PLATFORM_SITE_PKG=${PYTHON_SITE_PACKAGES}
105+ export PYTHON_SITELIB=${PYTHON_SITE_PACKAGES}
106+ export PYTHON_PREFIX=${PYTHON_SITE_PACKAGES}
107+ export PKG_CONFIG_PATH=${PIXI_ENV} /lib/pkgconfig
108+ export PYTHONDIR=${PYTHON_SITE_PACKAGES}
109+
110+ # Set these to empty.
111+ # PYTHON=${PIXI_ENV}/bin/python3
112+ # CORRECT_EXTRA_LIBS="$(${PYTHON} -c "import sysconfig; print(sysconfig.get_config_var(\"LIBS\"))")"
113+ # CORRECT_EXTRA_LDFLAGS="$(${PYTHON} -c "import sysconfig; print(sysconfig.get_config_var(\"LINKFORSHARED\"))")"
114+ export PYTHON_EXTRA_LDFLAGS=" "
115+ export PYTHON_EXTRA_LIBS=" "
116+
117+ echo " PKG_CONFIG_PATH: ${PKG_CONFIG_PATH} "
118+ echo " PYTHON_PREFIX: ${PYTHON_PREFIX} "
119+ echo " PYTHON_SITE_PACKAGES: ${PYTHON_SITE_PACKAGES} "
120+ echo " PYTHON_EXEC_PREFIX: ${PYTHON_EXEC_PREFIX} "
112121else
122+ PIXI_ROOT=/home/runner/work/flux-python/flux-python/.pixi
123+ export PIXI_ENV=${PIXI_ROOT} /envs/${PYTHON_VERSION}
113124 sed -i " s/package_version = \" develop\" /package_version = \" $FLUX_VERSION \" /" setup.py
125+ CPPFLAGS=" -I${PIXI_ENV} /include"
114126fi
115127
128+ # Can we remove need for setuptools?
129+ export PYTHON=${PIXI_ENV} /bin/python3
130+ export PYTHON_EXECUTABLE=${PIXI_ENV} /bin/python3
131+ export PYTHON_NOVERSIONCHECK=yes
132+ export LUA_CFLAGS=" -I${PIXI_ENV} /include"
133+ export LDFLAGS=" -L${PIXI_ENV} /lib -L${PIXI_ENV} /lib64"
134+ echo " Found lua.h in:\n$( find ${PIXI_ROOT} -name lua.h) " || echo " Did not find lua.h"
135+
116136# Store current directory
117137here=$( pwd)
138+ luarocks install luaposix
118139
119- # Install Python requirements using the OS-specific pip command - allow for ubuntu to be 24.04 or not.
120- # I like how "--break-system-packages" is analogous with --i-acknowledge-i-am-a-terrible-person
121- if [[ " $( uname) " == " Darwin" ]]; then
122- echo " Installing python requirements for MacOS"
123- ${PIP_INSTALL} IPython setuptools ply sphinx cffi pyyaml
124- ${PIP_INSTALL} -r .github/scripts/requirements-dev.txt
125- else
126- echo " Installing python requirements for Linux"
127- ${PIP_INSTALL} IPython pyyaml || ${PIP_INSTALL} IPython --break-system-packages pyyaml
128- ${PIP_INSTALL} -r .github/scripts/requirements-dev.txt || ${PIP_INSTALL} -r .github/scripts/requirements-dev.txt --break-system-packages
129-
130- # Flux Security --
131- # Does not have a variant for Mac
140+ # Flux Security --
141+ # Does not have a variant for Mac
142+ if [[ " $( uname) " != " Darwin" ]]; then
132143 git clone https://github.com/flux-framework/flux-security ~ /security
133144 cd ~ /security
134145 ./autogen.sh
135- PYTHON_PREFIX=PYTHON_EXEC_PREFIX= ${PYTHON_PREFIX} PYTHON=/opt/conda/bin/python3 ./configure --prefix=/usr/local
146+ ./configure --prefix=/usr/local
136147 make
137148 sudo make install
138149 sudo ldconfig
@@ -149,11 +160,12 @@ chmod +x etc/gen-cmdhelp.py
149160./autogen.sh || echo " No autogen here"
150161
151162if [[ " $( uname) " == " Darwin" ]]; then
152- CPPFLAGS=" $CPPFLAGS " PKG_CONFIG_PATH=$PKG_CONFIG_PATH ./configure --prefix=/usr/local
163+ CPPFLAGS=" $CPPFLAGS " CFLAGS= " ${CPPFLAGS} " LDFLAGS= " ${LDFLAGS} " PKG_CONFIG_PATH=$PKG_CONFIG_PATH ./configure --prefix=/usr/local || (cp ./config.log ../ && exit 1)
153164 ls ./scripts
154- ./scripts/check-macos.sh || echo " No check-macos.sh "
165+ ./scripts/check-macos.sh || (cp ./config.log ../ && exit 1)
155166else
156- ./configure --prefix=/usr/local
167+ ./configure CPPFLAGS=" $CPPFLAGS " CFLAGS=" ${CPPFLAGS} " LDFLAGS=" ${LDFLAGS} " --prefix=/usr/local
168+ cp ./config.log ../
157169 make VERBOSE=1
158170 sudo make install || true
159171 sudo make install
0 commit comments