ogrisel / python-appveyor-demo

Demo project for building Python wheels with appveyor.com
Creative Commons Zero v1.0 Universal
154 stars 55 forks source link

2.6.6 is only Python 2.6 release which works #10

Closed jayvdb closed 9 years ago

jayvdb commented 9 years ago

So others don't have to reproduce my pain, documenting this delightful fact somewhere would be good.

get-pip.py fails for 2.6.5 or lower : https://github.com/pypa/pip/issues/2494

And later releases of Python 2.6 do not include msi installers. e.g. https://www.python.org/ftp/python/2.6.9/

ogrisel commented 9 years ago

Thanks for the report, any suggestion where this check should be included? Would you like to submit a PR for this?

jayvdb commented 9 years ago

I've submitted a PR to include 2.6.6 in the build matrix, with a link to this issue. That should be sufficient for most people. We could add a sanity check in install.ps1 for 2.6.7+, but the error that occurs now (cant download msi) is pretty self explanatory, if a little ugly. I am keen on getting the pip bug fixes so that 2.6.5 will work, as that is the supposed minimum that https://github.com/wikimedia/pywikibot-core works on.

ogrisel commented 9 years ago

Closing this now that #10 is merged.

giampaolo commented 9 years ago

How can I install pip on Python 2.6? I could do this:

  - ps: (new-object net.webclient).DownloadFile('https://raw.github.com/pypa/pip/master/contrib/get-pip.py', 'C:/get-pip.py')
  - "%PYTHON%/python.exe C:/get-pip.py"
  - "%PYTHON%/python.exe -m pip install ..."

...but I'm not sure how to use conditionals, that is: execute the code above only for python 2.6. Any hint?

jayvdb commented 9 years ago

@giampaolo , install.ps1 does install pip for all versions of Python that are in the example build matrix. For Python 2.6, you must use Python version 2.6.6, rather than the latest 2.6.9 as it is the latest 2.6 release with an MSI installer.

PYTHON=C:\Python266, PYTHON_VERSION=2.6.6, PYTHON_ARCH=32

See https://ci.appveyor.com/project/ogrisel/python-appveyor-demo/build/1.0.129/job/mfdtlye9bd3gvrlp#L73

And it can be invoked using

%CMD_IN_ENV% pip install -r dev-requirements.txt

See https://ci.appveyor.com/project/ogrisel/python-appveyor-demo/build/1.0.129/job/mfdtlye9bd3gvrlp#L83 to see this in action.

If you still need conditionals, you'll need to use either cmd.exe IF syntax (ugly!), or (my preference) PowerShell, or ... use python since it is also available.

giampaolo commented 9 years ago

Problem is I want to do this:

  - ps: (new-object net.webclient).DownloadFile('https://raw.github.com/pypa/pip/master/contrib/get-pip.py', 'C:/get-pip.py')
  - "%PYTHON%/python.exe C:/get-pip.py"

...only for python 2.6.

giampaolo commented 9 years ago

My conf file: https://github.com/giampaolo/psutil/blob/master/appveyor.yml

ogrisel commented 9 years ago

Problem is I want to do this: ... ...only for python 2.6.

The install.ps1 already does that internally. Why not just reuse it?

giampaolo commented 9 years ago

I can reuse it but I don't want to install pip twice for all supported python versions, only once for python 2.6. See where I'm getting at?

ogrisel commented 9 years ago

As I said this is precisely what the script does. Read the code I linked in my previous comment.

jayvdb commented 9 years ago

Wow, sorry for the noise above. I didnt realise it would spam this issue number. (The problem in my previous PR was I needed a 'noop' :/)

I now have two working solutions for this problem.

Both of them used --trusted-host for get-pip.py , however they differ in how they install ndg-httpsclient and its dependencies. Either:

  1. automatically install ndg-httpsclient in install.ps1: https://github.com/jayvdb/python-appveyor-demo/tree/2.6.5-auto-install ; https://github.com/jayvdb/python-appveyor-demo/commit/66154503ef19e6572b77b0cfcda06f558ac7a3c8
  2. explicitly install ndg-httpsclient in appveyor.yml : https://github.com/jayvdb/python-appveyor-demo/tree/2.6.5-manual-install ; https://github.com/jayvdb/python-appveyor-demo/commit/d2af011ecf7fd08e746832409f675f619de4b316

Option 1 is easier for people copying this demo into their own project. I am a bit uneasy about automatically installing a lot of extra packages automatically - that taints the build so it is no longer a vanilla Python environment.

So I prefer the second option, as it allows the re-user of this demo to see what is needed, and why.

The second option might be improved by adding something like the following into the relevant if branch.

            Write-Host "On Python 2.6.5 and lower, either install ndg-httpsclient or add pip option: --trusted-host pypi.python.org"
jayvdb commented 9 years ago

Just noting that the original problem with Python 2.6.5 still exists https://ci.appveyor.com/project/jayvdb/python-appveyor-demo/build/job/g5h90f8llfe0mmwr