Skip to content

Commit

Permalink
Merge branch 'updates' of github.com:elijahr/asdf-nim into updates
Browse files Browse the repository at this point in the history
  • Loading branch information
elijahr committed Nov 5, 2024
2 parents c34d23e + 8d56467 commit c35b179
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions bin/exec-env
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
if [ "${ASDF_NIM_MACOS_M1_HOMEBREW_WORKAROUND:-yes}" = "yes" ] &&
[ "$(uname)" = "Darwin" ] &&
[ "$(uname -m)" = "arm64" ] &&
[ "${DYLD_LIBRARY_PATH:-}" = "" ] &&
[ "${DYLD_LIBRARY_PATH-}" = "" ] &&
[ -d /opt/homebrew/lib ]; then
export DYLD_LIBRARY_PATH
DYLD_LIBRARY_PATH=/opt/homebrew/lib
Expand All @@ -28,7 +28,7 @@ export NIMBLE_DIR
# Otherwise if the current working directory has a nimbledeps directory, use that.
# Otherwise, use the nimble directory within ASDF_INSTALL_PATH.
# see https://github.com/nim-lang/nimble#nimbles-folder-structure-and-packages
if [ "${NIMBLE_DIR:-}" = "" ] &&
if [ "${NIMBLE_DIR-}" = "" ] &&
[ ! -d "${PWD}/nimbledeps" ]; then
NIMBLE_DIR="${ASDF_INSTALL_PATH}/nimble"
fi
16 changes: 8 additions & 8 deletions lib/utils.bash
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ asdf_nim_init() {
# End configuration options

# Ensure ASDF_DATA_DIR has a value
if [ -n "${ASDF_INSTALL_PATH:-}" ]; then
if [ -n "${ASDF_INSTALL_PATH-}" ]; then
export ASDF_DATA_DIR
ASDF_DATA_DIR="${ASDF_DATA_DIR:-$HOME/.asdf}"
export ASDF_NIM_TEMP
Expand Down Expand Up @@ -94,7 +94,7 @@ asdf_nim_on_exit() {

asdf_nim_cleanup_asdf_download_path() {
if [ -d "$ASDF_DOWNLOAD_PATH" ]; then
if [ "${1:-}" = "force" ]; then
if [ "${1-}" = "force" ]; then
# Force delete
step_start "rm ${ASDF_DOWNLOAD_PATH//${HOME}/\~}"
rm -rf "$ASDF_DOWNLOAD_PATH"
Expand Down Expand Up @@ -131,7 +131,7 @@ asdf_nim_on_exit() {
# any cleanup here... *unless* ASDF_NIM_SIGNAL is set, in which case
# install will not be called and ASDF_DOWNLOAD_PATH should be deleted
# regardless of --keep-download/always_keep_download.
case "${ASDF_NIM_SIGNAL:-}" in
case "${ASDF_NIM_SIGNAL-}" in
SIG*)
# cleanup everything
asdf_nim_cleanup_asdf_install_path
Expand Down Expand Up @@ -247,7 +247,7 @@ asdf_nim_normalize_arch() {
arch="${ASDF_NIM_MOCK_MACHINE_NAME:-$(uname -m)}"
case "$arch" in
x86_64 | x64 | amd64)
if [ -n "$(command -v gcc)" ] || [ -n "${ASDF_NIM_MOCK_GCC_DEFINES:-}" ]; then
if [ -n "$(command -v gcc)" ] || [ -n "${ASDF_NIM_MOCK_GCC_DEFINES-}" ]; then
# Edge case: detect 386 container on amd64 kernel using __amd64 definition
IS_AMD64="$(echo "${ASDF_NIM_MOCK_GCC_DEFINES:-$(gcc -dM -E - </dev/null)}" | grep "#define __amd64 " | sed 's/#define __amd64 //')"
if [ "$IS_AMD64" = "1" ]; then
Expand All @@ -269,15 +269,15 @@ asdf_nim_normalize_arch() {
;;
arm*)
arm_arch=""
if [ -n "$(command -v gcc)" ] || [ -n "${ASDF_NIM_MOCK_GCC_DEFINES:-}" ]; then
if [ -n "$(command -v gcc)" ] || [ -n "${ASDF_NIM_MOCK_GCC_DEFINES-}" ]; then
# Detect arm32 version using __ARM_ARCH definition
arch_version="$(echo "${ASDF_NIM_MOCK_GCC_DEFINES:-$(gcc -dM -E - </dev/null)}" | grep "#define __ARM_ARCH " | sed 's/#define __ARM_ARCH //')"
if [ -n "$arch_version" ]; then
arm_arch="armv$arch_version"
fi
fi
if [ -z "$arm_arch" ]; then
if [ -n "$(command -v dpkg)" ] || [ -n "${ASDF_NIM_MOCK_DPKG_ARCHITECTURE:-}" ]; then
if [ -n "$(command -v dpkg)" ] || [ -n "${ASDF_NIM_MOCK_DPKG_ARCHITECTURE-}" ]; then
# Detect arm32 version using dpkg
case "${ASDF_NIM_MOCK_DPKG_ARCHITECTURE:-"$(dpkg --print-architecture)"}" in
armel) arm_arch="armv5" ;;
Expand Down Expand Up @@ -398,7 +398,7 @@ asdf_nim_install_deps() {
# Detect if the standard C library on the system is musl or not.
# Echoes "yes" or "no"
asdf_nim_is_musl() {
if [ -n "${ASDF_NIM_MOCK_IS_MUSL:-}" ]; then
if [ -n "${ASDF_NIM_MOCK_IS_MUSL-}" ]; then
echo "$ASDF_NIM_MOCK_IS_MUSL"
else
if [ -n "$(command -v ldd)" ]; then
Expand Down Expand Up @@ -464,7 +464,7 @@ asdf_nim_nightly_url() {
}

asdf_nim_github_token() {
echo "${GITHUB_TOKEN:-${GITHUB_API_TOKEN:-}}"
echo "${GITHUB_TOKEN:-${GITHUB_API_TOKEN-}}"
}

# Echo the source archive URL (from nim-lang.org).
Expand Down
2 changes: 1 addition & 1 deletion shims/nimble
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ trap 'trap - INT; SIGNAL=SIGINT; regenerate; kill -INT $$' INT
trap 'trap - TERM; SIGNAL=SIGTERM; regenerate; kill -TERM $$' TERM

if "${ASDF_INSTALL_BIN_PATH}/nimble" "$@"; then
case "${1:-}" in
case "${1-}" in
install | develop | uninstall)
regenerate
;;
Expand Down
2 changes: 1 addition & 1 deletion test/lib/test_utils.bash
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ setup_test() {
export XDG_CONFIG_HOME
XDG_CONFIG_HOME="$ASDF_NIM_TEST_TEMP"
export ACTUAL_GITHUB_TOKEN
ACTUAL_GITHUB_TOKEN="${GITHUB_TOKEN:-}"
ACTUAL_GITHUB_TOKEN="${GITHUB_TOKEN-}"
export GITHUB_TOKEN
GITHUB_TOKEN=""
export GITHUB_USER
Expand Down

0 comments on commit c35b179

Please sign in to comment.