Commit b4cb6ab4 authored by richardARPANET's avatar richardARPANET

fixes bug with index urls in reqs, and bug when version for a package could not be found

parent fcfd3ef6
......@@ -6,7 +6,8 @@ Release History
0.1.1 (unreleased)
++++++++++++++++++
- Nothing changed yet.
- Bugfix, Fixes bug around --index-url and --extra-index url in requirements.txt, lines would get removed.
- Bugfix, if a package version could not be found the version "None" would be assigned, the fix makes no version be assigned to that package.
0.1.0 (2019-02-06)
......
......@@ -25,7 +25,10 @@ def _lock_requirements(*, input_path, output_path, endpoint):
)
extras = sorted(req.extras)
extras_str = f'[{",".join(extras)}]' if extras else ''
output_lines.append(f'{req.name}{extras_str}=={version}\n')
if version is None:
output_lines.append(f'{req.name}{extras_str}\n')
else:
output_lines.append(f'{req.name}{extras_str}=={version}\n')
with open(output_path, 'w') as file_:
for line in output_lines:
......
......@@ -22,6 +22,8 @@ def parse(reqstr):
continue
elif line.startswith('-r') or line.startswith('--requirement'):
yield line
elif line.startswith('--'):
yield line
elif line.startswith('-f') or line.startswith('--find-links') or \
line.startswith('-i') or line.startswith('--index-url') or \
line.startswith('--extra-index-url') or \
......
This diff is collapsed.
interactions:
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- pypi-simple/0.5.0 (https://github.com/jwodder/pypi-simple) requests/2.22.0
CPython/3.7.2
method: GET
uri: https://pypi.org/simple/package-which-is-not-found/
response:
body:
string: 404 Not Found
headers:
Accept-Ranges:
- bytes
Connection:
- keep-alive
Content-Length:
- '13'
Content-Security-Policy:
- default-src 'none'; sandbox allow-top-navigation
Content-Type:
- text/plain; charset=UTF-8
Date:
- Fri, 16 Aug 2019 13:27:37 GMT
Referrer-Policy:
- origin-when-cross-origin
Server:
- nginx/1.13.9
Strict-Transport-Security:
- max-age=31536000; includeSubDomains; preload
Vary:
- Accept-Encoding
X-Cache:
- MISS, MISS
X-Cache-Hits:
- 0, 0
X-Content-Type-Options:
- nosniff
X-Frame-Options:
- deny
X-Permitted-Cross-Domain-Policies:
- none
X-Served-By:
- cache-iad2133-IAD, cache-lcy19261-LCY
X-Timer:
- S1565962058.567281,VS0,VE105
X-XSS-Protection:
- 1; mode=block
status:
code: 404
message: Not Found
version: 1
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
--index-url https://pypi.org/simple/
--extra-index-url https://${FURY_TOKEN}@pypi.fury.io/acme-inc/
-r ../../requirements.txt
requests
-e git://github.com/mozilla/elasticutils.git#egg=elasticutils
imdbpie==0.1.0
celery[sqs,s3]
some-private-package
......@@ -19,17 +19,20 @@ def test_lock_requirements(tmpdir):
with open(output_file, 'r') as file_:
data = file_.readlines()
assert data == [
'--index-url https://pypi.org/simple/\n',
'--extra-index-url https://${FURY_TOKEN}@pypi.fury.io/acme-inc/\n',
'-r ../../requirements.txt\n',
'requests==2.21.0\n',
'requests==2.22.0\n',
'-e git://github.com/mozilla/elasticutils.git#egg=elasticutils\n',
'imdbpie==5.6.3\n',
'celery[s3,sqs]==4.2.1\n',
'imdbpie==5.6.4\n',
'celery[s3,sqs]==4.4.0rc3\n',
'some-private-package\n',
]
@pytest.mark.parametrize('package_name, expected_result', [
('requests', ('requests', '2.21.0')),
('imdbpie', ('imdbpie', '5.6.3')),
('requests', ('requests', '2.22.0')),
('imdbpie', ('imdbpie', '5.6.4')),
('package-which-is-not-found', ('package-which-is-not-found', None)),
])
def test_get_latest_versions(package_name, expected_result):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment