#71 Python template: Fix PyPI name declaration
Merged 3 years ago by ngompa. Opened 3 years ago by salimma.
salimma/rpmdevtools fix-python-name-declaration  into  master

Python template: Fix PyPI name declaration
Michel Alexandre Salim • 3 years ago  
file modified
+11 -11
@@ -1,8 +1,8 @@ 

  %{?!python3_pkgversion:%global python3_pkgversion 3}

  

- %global %pypi_name ...

+ %global srcname ...

  

- Name:           python-%{pypi_name}

+ Name:           python-%{srcname}

  Version:        

  Release:        1%{?dist}

  Summary:        
@@ -21,21 +21,21 @@ 

  ...

  

  

- %package -n python%{python3_pkgversion}-%{pypi_name}

+ %package -n python%{python3_pkgversion}-%{srcname}

  Summary:        %{summary}

- %{?python_provide:%python_provide python3-%{pypi_name}}

+ %{?python_provide:%python_provide python3-%{srcname}}

  

  %if %{undefined python_enable_dependency_generator} && %{undefined python_disable_dependency_generator}

  # Put manual requires here:

  Requires:       python%{python3_pkgversion}-foo

  %endif

  

- %description -n python%{python3_pkgversion}-%{pypi_name}

+ %description -n python%{python3_pkgversion}-%{srcname}

  ...

  

  

  %prep

- %autosetup -p1

+ %autosetup -p1 -n %{srcname}-%{version}

  

  

  %build
@@ -55,16 +55,16 @@ 

  ...

  

  

- %files -n  python%{python3_pkgversion}-%{pypi_name}

+ %files -n  python%{python3_pkgversion}-%{srcname}

  %{!?_licensedir:%global license %%doc}

  %license add-license-file-here

  %doc add-docs-here

  # For noarch packages: sitelib

- %{python3_sitelib}/%{pypi_name}/

- %{python3_sitelib}/%{pypi_name}-%{version}-py%{python3_version}.egg-info/

+ %{python3_sitelib}/%{srcname}/

+ %{python3_sitelib}/%{srcname}-%{version}-py%{python3_version}.egg-info/

  # For arch-specific packages: sitearch

- %{python3_sitearch}/%{pypi_name}/

- %{python3_sitelib}/%{pypi_name}-%{version}-py%{python3_version}.egg-info/

+ %{python3_sitearch}/%{srcname}/

+ %{python3_sitelib}/%{srcname}-%{version}-py%{python3_version}.egg-info/

  

  

  %changelog

%global %pypi_name would not expand correctly because of the extra %.

Remove it, and switch to using srcname which is preferred now per

https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_source_files_from_pypi

Signed-off-by: Michel Alexandre Salim salimma@fedoraproject.org

If you're going to change to %srcname, then fix all the references to %pypi_name to use it too...

rebased onto b825b9900047c082a1a563944150165414f47dbe

3 years ago

rebased onto 0b23bd4

3 years ago

Pull-Request has been merged by ngompa

3 years ago

Merged, thanks for the patch!

Metadata