forked from rpms/python-rpm-macros
Strip tildes from %version in %pypi_source by default, add tests
This commit is contained in:
parent
0d3f1e6b74
commit
4569c61d8d
@ -119,7 +119,7 @@
|
|||||||
# Accepts zero to three arguments:
|
# Accepts zero to three arguments:
|
||||||
# 1: The PyPI project name, defaulting to %srcname if it is defined, then
|
# 1: The PyPI project name, defaulting to %srcname if it is defined, then
|
||||||
# %pypi_name if it is defined, then just %name.
|
# %pypi_name if it is defined, then just %name.
|
||||||
# 2: The PYPI version, defaulting to %version.
|
# 2: The PYPI version, defaulting to %version with tildes stripped.
|
||||||
# 3: The file extension, defaulting to "tar.gz". (A period will be added
|
# 3: The file extension, defaulting to "tar.gz". (A period will be added
|
||||||
# automatically.)
|
# automatically.)
|
||||||
# Requires %__pypi_url and %__pypi_default_extension to be defined.
|
# Requires %__pypi_url and %__pypi_default_extension to be defined.
|
||||||
@ -146,7 +146,7 @@
|
|||||||
\
|
\
|
||||||
-- If no second argument, use %version
|
-- If no second argument, use %version
|
||||||
if ver == '%2' then
|
if ver == '%2' then
|
||||||
ver = rpm.expand('%version')
|
ver = rpm.expand('%version'):gsub('~', '')
|
||||||
end
|
end
|
||||||
\
|
\
|
||||||
-- If no third argument, use the preset default extension
|
-- If no third argument, use the preset default extension
|
||||||
|
@ -109,6 +109,7 @@ install -m 644 compileall2.py %{buildroot}%{_rpmconfigdir}/redhat/
|
|||||||
%changelog
|
%changelog
|
||||||
* Mon May 11 2020 Miro Hrončok <mhroncok@redhat.com> - 3.8-8
|
* Mon May 11 2020 Miro Hrončok <mhroncok@redhat.com> - 3.8-8
|
||||||
- Implement %%pytest
|
- Implement %%pytest
|
||||||
|
- Strip tildes from %%version in %%pypi_source by default
|
||||||
|
|
||||||
* Thu May 07 2020 Miro Hrončok <mhroncok@redhat.com> - 3.8-7
|
* Thu May 07 2020 Miro Hrončok <mhroncok@redhat.com> - 3.8-7
|
||||||
- Change %%__default_python3_pkgversion from 38 to 3.8
|
- Change %%__default_python3_pkgversion from 38 to 3.8
|
||||||
|
@ -132,3 +132,57 @@ def test_pytest_passes_options_naturally():
|
|||||||
def test_pytest_different_command():
|
def test_pytest_different_command():
|
||||||
lines = rpm_eval('%pytest', __pytest='pytest-3')
|
lines = rpm_eval('%pytest', __pytest='pytest-3')
|
||||||
assert 'pytest-3' in lines[-1]
|
assert 'pytest-3' in lines[-1]
|
||||||
|
|
||||||
|
|
||||||
|
def test_pypi_source_default_name():
|
||||||
|
url = rpm_eval('%pypi_source',
|
||||||
|
name='foo', version='6')[0]
|
||||||
|
assert url == 'https://files.pythonhosted.org/packages/source/f/foo/foo-6.tar.gz'
|
||||||
|
|
||||||
|
|
||||||
|
def test_pypi_source_default_srcname():
|
||||||
|
url = rpm_eval('%pypi_source',
|
||||||
|
name='python-foo', srcname='foo', version='6')[0]
|
||||||
|
assert url == 'https://files.pythonhosted.org/packages/source/f/foo/foo-6.tar.gz'
|
||||||
|
|
||||||
|
|
||||||
|
def test_pypi_source_default_pypi_name():
|
||||||
|
url = rpm_eval('%pypi_source',
|
||||||
|
name='python-foo', pypi_name='foo', version='6')[0]
|
||||||
|
assert url == 'https://files.pythonhosted.org/packages/source/f/foo/foo-6.tar.gz'
|
||||||
|
|
||||||
|
|
||||||
|
def test_pypi_source_default_name_uppercase():
|
||||||
|
url = rpm_eval('%pypi_source',
|
||||||
|
name='Foo', version='6')[0]
|
||||||
|
assert url == 'https://files.pythonhosted.org/packages/source/F/Foo/Foo-6.tar.gz'
|
||||||
|
|
||||||
|
|
||||||
|
def test_pypi_source_provided_name():
|
||||||
|
url = rpm_eval('%pypi_source foo',
|
||||||
|
name='python-bar', pypi_name='bar', version='6')[0]
|
||||||
|
assert url == 'https://files.pythonhosted.org/packages/source/f/foo/foo-6.tar.gz'
|
||||||
|
|
||||||
|
|
||||||
|
def test_pypi_source_provided_name_version():
|
||||||
|
url = rpm_eval('%pypi_source foo 6',
|
||||||
|
name='python-bar', pypi_name='bar', version='3')[0]
|
||||||
|
assert url == 'https://files.pythonhosted.org/packages/source/f/foo/foo-6.tar.gz'
|
||||||
|
|
||||||
|
|
||||||
|
def test_pypi_source_provided_name_version_ext():
|
||||||
|
url = rpm_eval('%pypi_source foo 6 zip',
|
||||||
|
name='python-bar', pypi_name='bar', version='3')[0]
|
||||||
|
assert url == 'https://files.pythonhosted.org/packages/source/f/foo/foo-6.zip'
|
||||||
|
|
||||||
|
|
||||||
|
def test_pypi_source_prerelease():
|
||||||
|
url = rpm_eval('%pypi_source',
|
||||||
|
name='python-foo', pypi_name='foo', version='6~b2')[0]
|
||||||
|
assert url == 'https://files.pythonhosted.org/packages/source/f/foo/foo-6b2.tar.gz'
|
||||||
|
|
||||||
|
|
||||||
|
def test_pypi_source_explicit_tilde():
|
||||||
|
url = rpm_eval('%pypi_source foo 6~6',
|
||||||
|
name='python-foo', pypi_name='foo', version='6')[0]
|
||||||
|
assert url == 'https://files.pythonhosted.org/packages/source/f/foo/foo-6~6.tar.gz'
|
||||||
|
Loading…
Reference in New Issue
Block a user