diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 32eaffc0..0b3b0643 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -58,7 +58,7 @@ jobs: arch: aarch64 openssl_archs: linux-aarch64 staticx: yes - - os: macos-12 + - os: macos-13 jid: 6 goal: build arch: x86_64 @@ -75,7 +75,7 @@ jobs: openssl_archs: VC-WIN64A - os: ubuntu-22.04 goal: test - python: "3.8" + python: "3.13" jid: 10 arch: x86_64 - os: ubuntu-22.04 @@ -115,7 +115,7 @@ jobs: with: path: | cache.tar.xz - key: gam-${{ matrix.jid }}-20240916 + key: gam-${{ matrix.jid }}-20240918 - name: Untar Cache archive if: matrix.goal == 'build' && steps.cache-python-ssl.outputs.cache-hit == 'true' @@ -301,7 +301,8 @@ jobs: - name: Rename GNU link on Windows if: matrix.goal == 'build' && runner.os == 'Windows' && steps.cache-python-ssl.outputs.cache-hit != 'true' shell: bash - run: mv /usr/bin/link /usr/bin/gnulink + run: | + mv -v /usr/bin/link /usr/bin/gnulink - name: Make OpenSSL if: matrix.goal == 'build' && steps.cache-python-ssl.outputs.cache-hit != 'true' @@ -319,7 +320,7 @@ jobs: cd "${GITHUB_WORKSPACE}/src/openssl-${openssl_arch}" # install_sw saves us ages processing man pages :-) $MAKE install_sw - mv "${OPENSSL_INSTALL_PATH}" "${GITHUB_WORKSPACE}/bin/ssl-${openssl_arch}" + mv -v "${OPENSSL_INSTALL_PATH}" "${GITHUB_WORKSPACE}/bin/ssl-${openssl_arch}" done mkdir -vp "${OPENSSL_INSTALL_PATH}/lib" mkdir -vp "${OPENSSL_INSTALL_PATH}/bin" @@ -530,8 +531,7 @@ jobs: if: matrix.goal != 'test' run: | export distpath="./dist/gam" - export gampath="$distpath" - mkdir -p -v "${gampath}" + mkdir -p -v "${distpath}" if [[ "${RUNNER_OS}" == "macOS" ]]; then # Tell our gam.spec to use our code sign certificate export codesign_identity="Jay Lee" @@ -539,38 +539,39 @@ jobs: # breaking our self-compiled version brew uninstall --ignore-dependencies openssl export PYINSTALLER_BUILD_ONEDIR=yes - export gampath=$($PYTHON -c "import os; print(os.path.realpath('${gampath}/gam'))") elif [[ "${RUNNER_OS}" == "Windows" ]]; then # Work around issue where PyInstaller picks up python3.dll from other Python versions # https://github.com/pyinstaller/pyinstaller/issues/7102 export PATH="$(dirname ${PYTHON}):/usr/bin" export PYINSTALLER_BUILD_ONEDIR=no - else - export gampath=$(realpath "${gampath}") - export PYINSTALLER_BUILD_ONEDIR=no + elif [[ "${staticx}" != "yes" ]]; then + export PYINSTALLER_BUILD_ONEDIR=yes fi - export gam="${gampath}/gam" - echo "gampath=${gampath}" >> $GITHUB_ENV "${PYTHON}" -m PyInstaller --clean --noconfirm --distpath="${distpath}" gam.spec - echo "dist results:" - ls -alRF "$distpath" - echo "WARNINGS FROM build/gam/warn-gam.txt" - cat build/gam/warn-gam.txt - echo "Analysis FROM build/gam/Analysis-00.toc" - cat build/gam/Analysis-00.toc - echo "EXE data FROM build/gam/EXE-00.toc" - cat build/gam/EXE-00.toc - if [ -x "$(command -v realpath)" ]; then - realpath=realpath + if [[ "$PYINSTALLER_BUILD_ONEDIR" == "yes" ]]; then + mv -v "${distpath}/gam" "${distpath}/gam7" + export gampath="${distpath}/gam7" else - brew install coreutils - realpath=grealpath + mv -v "$distpath" "${distpath}7" + export gampath="${distpath}7" fi - export gam=$(realpath "$gam") + export gampath=$(realpath "$gampath") + echo "gampath ${gampath} results:" + ls -alRF "$gampath" + #echo "WARNINGS FROM build/gam/warn-gam.txt" + #cat build/gam/warn-gam.txt + #echo "Analysis FROM build/gam/Analysis-00.toc" + #cat build/gam/Analysis-00.toc + #echo "EXE data FROM build/gam/EXE-00.toc" + #cat build/gam/EXE-00.toc + export gam="${gampath}/gam" if [[ "${RUNNER_OS}" == "Windows" ]]; then export gam=$(cygpath -w "$gam") echo "GAM on Windows at ${gam}" + else + export gam=$(realpath "$gam") fi + echo "gampath=${gampath}" >> $GITHUB_ENV echo "gam=${gam}" >> $GITHUB_ENV echo -e "GAM: ${gam}\nGAMPATH: ${gampath}" @@ -648,14 +649,14 @@ jobs: GAM_ARCHIVE="gam-${GAMVERSION}-linux-$(arch)-${libver}.tar.xz" fi echo "GAM Archive ${GAM_ARCHIVE}" - tar -C dist/ --create --verbose --exclude-from "${GITHUB_WORKSPACE}/.github/actions/package_exclusions.txt" --file $GAM_ARCHIVE --xz gam + tar -C "${gampath}/.." --create --verbose --exclude-from "${GITHUB_WORKSPACE}/.github/actions/package_exclusions.txt" --file $GAM_ARCHIVE --xz gam7 - name: Windows package if: runner.os == 'Windows' && matrix.goal != 'test' run: | - cd dist/ + cd "${gampath}/.." GAM_ARCHIVE="../gam-${GAMVERSION}-windows-${GAM_ARCHIVE_ARCH}.zip" - /c/Program\ Files/7-Zip/7z.exe a -tzip $GAM_ARCHIVE gam "-xr@${GITHUB_WORKSPACE}/.github/actions/package_exclusions.txt" -bb3 + /c/Program\ Files/7-Zip/7z.exe a -tzip $GAM_ARCHIVE gam7 "-xr@${GITHUB_WORKSPACE}/.github/actions/package_exclusions.txt" -bb3 cd .. /c/Program\ Files\ \(x86\)/WiX\ Toolset\ v3.14/bin/candle.exe -arch "${WIX_ARCH}" gam.wxs /c/Program\ Files\ \(x86\)/WiX\ Toolset\ v3.14/bin/light.exe -ext /c/Program\ Files\ \(x86\)/WiX\ Toolset\ v3.14/bin/WixUIExtension.dll gam.wixobj -o "gam-${GAMVERSION}-windows-${GAM_ARCHIVE_ARCH}.msi" || true; diff --git a/src/GamUpdate.txt b/src/GamUpdate.txt index 2ebd2f8f..5521a752 100644 --- a/src/GamUpdate.txt +++ b/src/GamUpdate.txt @@ -8,6 +8,11 @@ where 7.00.02 MacOS builds usually took ~7 seconds to run "gam version", 7.00.03 MacOS builds are now signed by Jay's Apple Developer ID and notarized (scanned for malware) by Apple. This should resolve MacOS security warnings that need to be overridden when running GAM. +Updated `gam delete ou` and `gam print admins` to handle the following error: +``` +ERROR: 503: serviceNotAvailable - The service is currently unavailable. +``` + 7.00.02 Added option `showlastmodification` to `gam print|show filecounts` that adds diff --git a/src/gam-install.sh b/src/gam-install.sh index 06e522de..07c0b97c 100755 --- a/src/gam-install.sh +++ b/src/gam-install.sh @@ -21,7 +21,7 @@ EOF } target_dir="$HOME/bin" -target_gam="gam/gam" +target_gam="gam7/gam" gamarch=$(uname -m) gamos=$(uname -s) osversion="" diff --git a/src/gam.spec b/src/gam.spec index a548442f..d0eac6bd 100644 --- a/src/gam.spec +++ b/src/gam.spec @@ -37,12 +37,12 @@ a = Analysis( cipher=None, noarchive=False, ) -print(f"datas from analysis:\n{a.datas}") +#print(f"datas from analysis:\n{a.datas}") for d in a.datas: if 'pyconfig' in d[0]: a.datas.remove(d) break -print(f"datas after pyconfig cleanup:\n{a.datas}") +#print(f"datas after pyconfig cleanup:\n{a.datas}") pyz = PYZ(a.pure, a.zipped_data, cipher=None) diff --git a/src/gam/__init__.py b/src/gam/__init__.py index e1e074c9..7e0cd64e 100755 --- a/src/gam/__init__.py +++ b/src/gam/__init__.py @@ -16623,13 +16623,15 @@ def doPrintShowAdmins(): try: admins = callGAPIpages(cd.roleAssignments(), 'list', 'items', pageMessage=getPageMessage(), - throwReasons=[GAPI.INVALID, GAPI.USER_NOT_FOUND, GAPI.BAD_REQUEST, - GAPI.CUSTOMER_NOT_FOUND, GAPI.FORBIDDEN], + throwReasons=[GAPI.INVALID, GAPI.USER_NOT_FOUND, + GAPI.FORBIDDEN, GAPI.SERVICE_NOT_AVAILABLE, + GAPI.BAD_REQUEST, GAPI.CUSTOMER_NOT_FOUND], + retryReasons=GAPI.SERVICE_NOT_AVAILABLE_RETRY_REASONS, customer=GC.Values[GC.CUSTOMER_ID], fields=fields, **kwargs) except (GAPI.invalid, GAPI.userNotFound): entityUnknownWarning(Ent.ADMINISTRATOR, userKey) return - except GAPI.forbidden as e: + except (GAPI.forbidden, GAPI.serviceNotAvailable) as e: entityActionFailedExit([Ent.ADMINISTRATOR, userKey, Ent.ADMIN_ROLE, roleId], str(e)) except (GAPI.badRequest, GAPI.customerNotFound): accessErrorExit(cd) @@ -17334,14 +17336,17 @@ def _doDeleteOrgs(entityList): try: orgUnitPath = makeOrgUnitPathAbsolute(orgUnitPath) callGAPI(cd.orgunits(), 'delete', - throwReasons=[GAPI.CONDITION_NOT_MET, GAPI.INVALID_ORGUNIT, GAPI.ORGUNIT_NOT_FOUND, GAPI.BACKEND_ERROR, GAPI.BAD_REQUEST, GAPI.INVALID_CUSTOMER_ID, GAPI.LOGIN_REQUIRED], + throwReasons=[GAPI.CONDITION_NOT_MET, GAPI.INVALID_ORGUNIT, GAPI.ORGUNIT_NOT_FOUND, GAPI.BACKEND_ERROR, + GAPI.INVALID_CUSTOMER_ID, GAPI.SERVICE_NOT_AVAILABLE, + GAPI.BAD_REQUEST, GAPI.LOGIN_REQUIRED], + retryReasons=GAPI.SERVICE_NOT_AVAILABLE_RETRY_REASONS, customerId=GC.Values[GC.CUSTOMER_ID], orgUnitPath=encodeOrgUnitPath(makeOrgUnitPathRelative(orgUnitPath))) entityActionPerformed([Ent.ORGANIZATIONAL_UNIT, orgUnitPath], i, count) except GAPI.conditionNotMet: entityActionFailedWarning([Ent.ORGANIZATIONAL_UNIT, orgUnitPath], Msg.HAS_CHILD_ORGS.format(Ent.Plural(Ent.ORGANIZATIONAL_UNIT)), i, count) except (GAPI.invalidOrgunit, GAPI.orgunitNotFound, GAPI.backendError): entityActionFailedWarning([Ent.ORGANIZATIONAL_UNIT, orgUnitPath], Msg.DOES_NOT_EXIST, i, count) - except GAPI.invalidCustomerId as e: + except (GAPI.invalidCustomerId, GAPI.serviceNotAvailable) as e: ### Check for my_customer entityActionFailedWarning([Ent.ORGANIZATIONAL_UNIT, orgUnitPath, Ent.CUSTOMER_ID, GC.Values[GC.CUSTOMER_ID]], str(e), i, count) except (GAPI.badRequest, GAPI.loginRequired): diff --git a/src/setup.cfg b/src/setup.cfg index d426edae..c9894fee 100644 --- a/src/setup.cfg +++ b/src/setup.cfg @@ -13,10 +13,10 @@ keywords = google, oauth2, gsuite, google-apps, google-admin-sdk, google-drive, classifiers = Programming Language :: Python :: 3 Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.11 + Programming Language :: Python :: 3.12 License :: OSI Approved :: Apache License [options]