Work around bandersnatch not supporting pep503

Temporary work around so our mirrors work with the latest pip release
that expects .'s to be replaced with -'s.

This is crude but considered easier than pinning pip across our services.
It may miss some edge cases so we'll see how it goes.

This should be reverted once bandersnatch supports pep503:
https://bitbucket.org/pypa/bandersnatch/pull-requests/20/fully-implement-pep-503-normalization/diff

Change-Id: Ic4acf4c1d4e78d2524ea49356c61916947fd9a3d
This commit is contained in:
Joshua Hesketh 2016-05-11 17:36:47 +10:00
parent 01838103b5
commit c640ca2d97

View File

@ -51,6 +51,16 @@ NameVirtualHost <%= @vhost_name %>:<%= @port %>
RewriteCond %{DOCUMENT_ROOT}/npm/$1/$1$2 -d
RewriteRule ^/npm/([^/])([^/]*)(/.*)?$ /npm/$1/$1$2$3 [L]
# TODO(jhesketh): Remove this after bandersnatch implements pep503
# https://bitbucket.org/pypa/bandersnatch/pull-requests/20/fully-implement-pep-503-normalization/diff
# Try again but replacing -'s with .'s
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_URI} !-f
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_URI} !-d
RewriteRule (.*)-(.*) $1.$2
RewriteCond %{REQUEST_URI} ^/pypi/simple/([^/])([^/]*)
RewriteCond %{DOCUMENT_ROOT}/pypi/simple/$1/$1$2 -d
RewriteRule ^/pypi/simple/([^/])([^/]*)(/.*)?$ /pypi/simple/$1/$1$2$3 [L]
<DirectoryMatch "<%= @docroot %>\/npm\/[^/]+\/.*">
DirectoryIndex index.json
AddOutputFilterByType SUBSTITUTE application/json