Kozea / cairocffi

CFFI-based cairo bindings for Python.
https://doc.courtbouillon.org/cairocffi
BSD 3-Clause "New" or "Revised" License
208 stars 54 forks source link

Support for Offline Builds #206

Closed theCapypara closed 2 years ago

theCapypara commented 2 years ago

This relates to #157

I don't know the specifics, but currently cairocffi seems to rely on deprecated setuptools functionality (installer). This tries to download depdencies during build time. This doesn't seem to play well with pip's offline build functionality, even when pip is using an offline index setuptools still tries to download the package, ignoring any settings passed to pip.

The dependency on setuptools installer should be removed and the project should be updated to follow modern Python packaging standards.

theCapypara commented 2 years ago

To add some context:

This command running in Flatpak build (no internet access): pip3 install --verbose --exists-action=i --no-index --find-links=\"file://${PWD}\" --prefix=${FLATPAK_DEST} \"CairoSVG==2.5.2\" --no-build-isolation

(the index at $PWD contains cairocffi and also cffi)

fails with:

  Running command python setup.py egg_info
  /usr/lib/python3.9/site-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
    warnings.warn(
  WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7fa0a958e970>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/cffi/
  WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7fa0a958ec70>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/cffi/
  WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7fa0a958eee0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/cffi/
  WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7fa0a9532190>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/cffi/
  WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7fa0a9532340>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/cffi/
  ERROR: Could not find a version that satisfies the requirement cffi>=1.1.0 (from versions: none)
  ERROR: No matching distribution found for cffi>=1.1.0
  Traceback (most recent call last):
    File "/usr/lib/python3.9/site-packages/setuptools/installer.py", line 82, in fetch_build_egg
      subprocess.check_call(cmd)
    File "/usr/lib/python3.9/subprocess.py", line 373, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command '['/usr/bin/python3', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmp8vxost4n', '--quiet', 'cffi>=1.1.0']' returned non-zero exit status 1.

  The above exception was the direct cause of the following exception:

  Traceback (most recent call last):
    File "<string>", line 2, in <module>
    File "<pip-setuptools-caller>", line 34, in <module>
    File "/tmp/pip-install-_9hs4twb/cairocffi_6657596a93704c51b5b0f765f7f120cc/setup.py", line 10, in <module>
      setup(
    File "/usr/lib/python3.9/site-packages/setuptools/__init__.py", line 152, in setup
      _install_setup_requires(attrs)
    File "/usr/lib/python3.9/site-packages/setuptools/__init__.py", line 147, in _install_setup_requires
      dist.fetch_build_eggs(dist.setup_requires)
    File "/usr/lib/python3.9/site-packages/setuptools/dist.py", line 812, in fetch_build_eggs
      resolved_dists = pkg_resources.working_set.resolve(
    File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 771, in resolve
      dist = best[req.key] = env.best_match(
    File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 1056, in best_match
      return self.obtain(req, installer)
    File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 1068, in obtain
      return installer(requirement)
    File "/usr/lib/python3.9/site-packages/setuptools/dist.py", line 883, in fetch_build_egg
      return fetch_build_egg(self, req)
    File "/usr/lib/python3.9/site-packages/setuptools/installer.py", line 84, in fetch_build_egg
      raise DistutilsError(str(e)) from e
  distutils.errors.DistutilsError: Command '['/usr/bin/python3', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmp8vxost4n', '--quiet', 'cffi>=1.1.0']' returned non-zero exit status 1.
theCapypara commented 2 years ago

Changed the title, since this doesn't actually have anything to do with isolated builds (mixed things up).

liZe commented 2 years ago

Hi!

This relates to #157

Yes, that would be resolved by removing pytest-runner. Let’s merge #171 and see what happens.

liZe commented 2 years ago

Fixed by #171.