fedora-python / pyp2rpm

Tool to convert a package from PyPI to RPM SPECFILE or to generate SRPM.
MIT License
125 stars 39 forks source link

Single-files modules cause __pycache__ directory ownership #67

Closed hroncok closed 7 years ago

hroncok commented 8 years ago

Let's have a Python package that does not create directory in %{pythonX_sitelib}, but only files, such as simpleeval.

pyp2rpm creates this %files section for the Py3 subpackage:

%files -n python3-%{pypi_name}
%doc README.rst
%dir %{python3_sitelib}/__pycache__/
%{python3_sitelib}/__pycache__/*
%{python3_sitelib}/%{pypi_name}.py
%{python3_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info

However the %{python3_sitelib}/__pycache__/ directory is owned by python3-libs / system-python-libs and thus should not be owned by our pakcage. The correct section follows:

%files -n python3-%{pypi_name}
%doc README.rst
%{python3_sitelib}/__pycache__/*
%{python3_sitelib}/%{pypi_name}.py
%{python3_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
mcyprian commented 7 years ago

Current output after application of 881a794 is:

simpleeval (packages: set(), py_modules: ['simpleeval']):

%files -n python2-%{pypi_name}
%doc README.rst
%{python2_sitelib}/%{pypi_name}.py*
%{python2_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info

%files -n python3-%{pypi_name}
%doc README.rst
%{python3_sitelib}/__pycache__/*
%{python3_sitelib}/%{pypi_name}.py
%{python3_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info

pyp2rpm (packages: {'pyp2rpm'}, py_modules: []):

%files -n python2-%{pypi_name}
%license tests/test_data/LICENSE LICENSE
%doc README.md
%{_bindir}/pyp2rpm
%{_bindir}/pyp2rpm-2
%{_bindir}/pyp2rpm-%{python2_version}
%{python2_sitelib}/%{pypi_name}
%{python2_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info

%files -n python3-%{pypi_name}
%license tests/test_data/LICENSE LICENSE
%doc README.md
%{_bindir}/pyp2rpm-3
%{_bindir}/pyp2rpm-%{python3_version}
%{python3_sitelib}/%{pypi_name}
%{python3_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info

pytest (packages: {'_pytest'}', py_modules: ['pytest']):

%files -n python2-%{pypi_name}
%license LICENSE doc/en/license.rst doc/en/_themes/LICENSE
%doc README.rst _pytest/vendored_packages/README.md
%{_bindir}/py.test
%{_bindir}/py.test-2
%{_bindir}/py.test-%{python2_version}
%{python2_sitelib}/%{pypi_name}.py*
%{python2_sitelib}/_pytest
%{python2_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info

%files -n python3-%{pypi_name}
%license LICENSE doc/en/license.rst doc/en/_themes/LICENSE
%doc README.rst _pytest/vendored_packages/README.md
%{_bindir}/py.test-3
%{_bindir}/py.test-%{python3_version}
%{python3_sitelib}/__pycache__/*
%{python3_sitelib}/%{pypi_name}.py
%{python3_sitelib}/_pytest
%{python3_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info