homebrew-core icon indicating copy to clipboard operation
homebrew-core copied to clipboard

iconsur: update test

Open chenrui333 opened this issue 1 year ago • 2 comments

  • [x] Have you followed the guidelines for contributing?
  • [x] Have you ensured that your commits follow the commit style guide?
  • [x] Have you checked that there aren't other open pull requests for the same formula update/change?
  • [x] Have you built your formula locally with HOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source <formula>, where <formula> is the name of the formula you're submitting?
  • [x] Is your test running fine brew test <formula>, where <formula> is the name of the formula you're submitting?
  • [x] Does your build pass brew audit --strict <formula> (after doing HOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source <formula>)? If this is a new formula, does it pass brew audit --new <formula>?

found in #163887

  ==> Testing iconsur
  ==> /opt/homebrew/Cellar/iconsur/1.7.0/bin/iconsur set /private/tmp/iconsur-test-20240223-90832-fsquse/Test.app -k AppleDeveloper
  Processing /private/tmp/iconsur-test-20240223-90832-fsquse/Test.app...
  Plist file might be corrupted; using fallback name and AppIcon.icns as default icon location.
  Re-run with option -k or --keyword to specify custom app name to search for.
  Re-run with option -i or --input to specify custom input image for an adaptive icon.
  (node:90842) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
  (Use `node --trace-deprecation ...` to show where the warning was created)
  Searching iOS App with name: AppleDeveloper
  Found iOS app: Apple Developer with icon: https://is1-ssl.mzstatic.com/image/thumb/Purple116/v4/f0/35/e8/f035e8fc-5cf5-e062-9b20-6c53a4e73854/AppIcon-Release-0-1x_U007emarketing-0-0-0-7-0-0-0-85-220-0.png/512x512bb.jpg
  If this app is incorrect, specify the correct name with -k or --keyword, or generate an icon locally with option -l or --local
  Performing one-time user-level installation of required Python packages: pyobjc-core pyobjc-framework-Cocoa - this can take while...
  error: externally-managed-environment
  
  × This environment is externally managed
  ╰─> To install Python packages system-wide, try brew install
      xyz, where xyz is the package you are trying to
      install.
      
      If you wish to install a non-brew-packaged Python package,
      create a virtual environment using python3 -m venv path/to/venv.
      Then use path/to/venv/bin/python and path/to/venv/bin/pip.
      
      If you wish to install a non-brew packaged Python application,
      it may be easiest to use pipx install xyz, which will manage a
      virtual environment for you. Make sure you have pipx installed.
  
  note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.

chenrui333 avatar Feb 23 '24 15:02 chenrui333

The test failure is correct and we should set up a separate venv for [email protected] otherwise failure will be seen by users.

Upstream code doesn't work with system /usr/bin/python3 (and tells users to install python@3) and it pip3 installs which doesn't work with PEP 668 https://github.com/rikumi/iconsur/blob/1.7.0/src/fileicon.sh#L230-L249

      local ec=$? packageNames='pyobjc-core pyobjc-framework-Cocoa'
      done=1
      if (( ec )); then # The call failed.
        (( retrying )) && die "An unexpected error occured: $output" # Even on-demand pyobjc installation failed -> abort.
        # First, make sure that `python3` is actually Python, and not just the *stub* executable.
        python3 --version | /usr/bin/grep -q ' 3.' || die "The 'python3' binary in your path is not functional, presumably because it is the preinstalled stub at /usr/bin/python3 that triggers a prompt for on-demand installation. Perform this installation, or, if you have Homebrew installed, install Python 3 with \`brew install python@3\`"
        # Assume that the problem is the absence of the required pyobjc-* packages; attempt installation now.
        # Tips for debugging:
        #  * To exercise this function, from the repo dir.:
        #      touch /tmp/tf; ./bin/fileicon set /tmp/tf ./test/.fixtures/img.png
        #  * To manage packages; prepend `sudo -H` to see machine-level packages
        #      pip3 list -v                                          # shows installed packages and their locations
        #      pip3 uninstall -y pyobjc-core pyobjc-framework-Cocoa  # uninstalls the required pyobjc-* packages
        #  * To manage pip3's package *cache*
        #      pip3 cache list   # list cached packages
        #      pip3 cache purge  # clear cache
        #      pip config set global.cache-dir false   # disable cache globally
        #      pip config unset global.cache-dir       # re-enable globacl cache
        echo "Performing one-time user-level installation of required Python packages: $packageNames - this can take while..." >&2
        pip3 install -q --user $packageNames || die "On-demand installation of Python packages failed unexpectedly."

cho-m avatar Feb 23 '24 15:02 cho-m

The test failure is correct and we should set up a separate venv for [email protected] otherwise failure will be seen by users.

Upstream code doesn't work with system /usr/bin/python3 (and tells users to install python@3) and it pip3 installs which doesn't work with PEP 668 https://github.com/rikumi/iconsur/blob/1.7.0/src/fileicon.sh#L230-L249

yeah, sounds about right

note, the python3 env change was done in https://github.com/rikumi/iconsur/pull/37 when macos removed the python2.

chenrui333 avatar Feb 23 '24 15:02 chenrui333

#165617

chenrui333 avatar Mar 09 '24 14:03 chenrui333