scoder · GitHub

I'm not sure if this pull-request has right direction but I've made small change to overcome following problem which I have. It'll be more than great if you'd merge this PR, provide feedback on this PR or anything else. Thanks in advance.

Problem
I want to realize CI of one Python project which uses lxml and other modules. To make preparation simple in CI, all of dependencies are written in requirements.txt and ready to be installed by pip install -r requirements.txt. Because the Python project is targeting Windows environment, I've also set up STATIC_DEPS=true in CI job.

However, build of lxml fails on CI servers because of no direct access to the Internet; Other modules are able to be installed through proxy server (with http_proxy and https_proxy environmental variables) but lxml is not because of usage of ftplib which doesn't take care of ftp_proxy environmental variable.

Downloading lxml-3.5.0.tar.gz (3.8MB)
Downloading from URL https://pypi.python.org/packages/source/l/lxml/lxml-3.5.0.tar.gz#md5=9f0c5f1eb43ff44d5455dab4b4efbe73 (from https://pypi.python.org/simple/lxml/)
Running setup.py (path:C:\Users\ADMINI~1\AppData\Local\Temp\pip-build-trs2ox77\lxml\setup.py) egg_info for package lxml
  Running command python setup.py egg_info
  Building lxml version 3.5.0.
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "C:\Users\ADMINI~1\AppData\Local\Temp\pip-build-trs2ox77\lxml\setup.py", line 233, in <module>
      **setup_extra_options()
    File "C:\Users\ADMINI~1\AppData\Local\Temp\pip-build-trs2ox77\lxml\setup.py", line 144, in setup_extra_options
      STATIC_CFLAGS, STATIC_BINARIES)
    File "C:\Users\ADMINI~1\AppData\Local\Temp\pip-build-trs2ox77\lxml\setupinfo.py", line 55, in ext_modules
      OPTION_DOWNLOAD_DIR, static_include_dirs, static_library_dirs)
    File "C:\Users\ADMINI~1\AppData\Local\Temp\pip-build-trs2ox77\lxml\buildlibxml.py", line 86, in get_prebuilt_libxml2xslt
      libs = download_and_extract_zlatkovic_binaries(download_dir)
    File "C:\Users\ADMINI~1\AppData\Local\Temp\pip-build-trs2ox77\lxml\buildlibxml.py", line 34, in download_and_extract_zlatkovic_binaries
      for fn in ftp_listdir(url):
    File "C:\Users\ADMINI~1\AppData\Local\Temp\pip-build-trs2ox77\lxml\buildlibxml.py", line 106, in ftp_listdir
      server = ftplib.FTP(netloc)
    File "C:\Python34\lib\ftplib.py", line 118, in __init__
      self.connect(host)
    File "C:\Python34\lib\ftplib.py", line 153, in connect
      source_address=self.source_address)
    File "C:\Python34\lib\socket.py", line 512, in create_connection
      raise err
    File "C:\Python34\lib\socket.py", line 503, in create_connection
      sock.connect(sa)
  TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

Read the original on github.com ↗