-
-
Notifications
You must be signed in to change notification settings - Fork 565
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace ftplib with urllib to pick up ftp_proxy when building lxml with STATIC_DEPS=true #189
Conversation
* Rewrite ftp_listdir to replace ftplib which doesn't take care of ftp_proxy environmental variable at all. * Add parse_text_ftplist and parse_html_ftplist as a kind of sub-function of ftp_listdir. - parse_text_ftplist will be called when ftp_proxy environmental variable is empty. - parse_html_ftplist will be called when ftp_proxy environmental variable is not empty (i.e. there's proxy server) and urllib gets some HTML generated by proxy server (e.g. squid) instead of plaintext.
Sorry, wrong button. :) This looks ok, and if it helps... |
Thank you for your comment. The '54' is because of LIST command in urllib (instead of NLST with ftplib); Here's what FTP server replays in case of direct access to FTP server. The '54' shouldn't be a problem as long as FTP server is running on Unix.
So how should I put explanation there? Shall I insert |
Well, " The correct way to do this is to not cut off a fixed length prefix, but to split the line into 9 parts ( |
Thank you. I pushed one more commit to follow your instruction. Also, it's good to know split(None). :) |
Thanks |
Replace ftplib with urllib to pick up ftp_proxy when building lxml with STATIC_DEPS=true
Hi, this breaks version detection on my pc. I had to make following patch: def download_libxml2(dest_dir, version=None):
"""Downloads libxml2, returning the filename where the library was downloaded"""
- version_re = re.compile(r'^LATEST_LIBXML2_IS_(.*)$')
+ version_re = re.compile(r'^-> libxml2-([0-9.]+[0-9]).tar.gz$')
filename = 'libxml2-%s.tar.gz'
return download_library(dest_dir, LIBXML2_LOCATION, 'libxml2',
version_re, filename, version=version)
def download_libxslt(dest_dir, version=None):
"""Downloads libxslt, returning the filename where the library was downloaded"""
- version_re = re.compile(r'^LATEST_LIBXSLT_IS_(.*)$')
+ version_re = re.compile(r'^-> libxslt-([0-9.]+[0-9]).tar.gz$')
filename = 'libxslt-%s.tar.gz'
return download_library(dest_dir, LIBXML2_LOCATION, 'libxslt',
version_re, filename, version=version) as a workaround |
Sorry for my breaking build on your pc. I suppose build is now broken on non-Windows environment because of difference between ftplib and urllib at ftp://xmlsoft.org/libxml2/ where I haven't checked at all; I checked my change only on Windows.
@scoder, Do you mind if I suggest fix by myself? I'm thinking following 3 changes:
If you or someone else wants to take it rather than to leave further changes by me, please feel free to let me know. |
I'm getting this error installing lxml (assume that this is related to this PR):
|
Using the latest buillibxml.py from master fixes my problem. 👍 |
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 bypip install -r requirements.txt
. Because the Python project is targeting Windows environment, I've also set upSTATIC_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
andhttps_proxy
environmental variables) but lxml is not because of usage of ftplib which doesn't take care offtp_proxy
environmental variable.Notes