radomirbosak / duden

CLI for http://duden.de dictionary written in Python
MIT License
101 stars 18 forks source link

Add rpm packaging #11

Open radomirbosak opened 8 years ago

jorgesumle commented 6 years ago

Apparently, you can execute python setup.py bdist --format=rpm. See https://docs.python.org/3.3/distutils/builtdist.html

radomirbosak commented 6 years ago

Nice, I didn't know this.

I tried the command (outside of the virtualenv) and it worked :)

Although.. I don't know if the produced rpm package (although functional) is correctly packaged for Fedora or RHEL. By looking at the generated .spec file, it looks like it's not using any system-packaged libraries.

%define name duden
%define version 0.10.0
%define unmangled_version 0.10.0
%define unmangled_version 0.10.0
%define release 1

Summary: CLI-based german dictionary
Name: %{name}
Version: %{version}
Release: %{release}
Source0: %{name}-%{unmangled_version}.tar.gz
License: MIT
Group: Development/Libraries
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
Prefix: %{_prefix}
BuildArch: noarch
Vendor: Radomír Bosák <radomir.bosak@gmail.com>
Url: https://github.com/radomirbosak/duden

%description
UNKNOWN

%prep
%setup -n %{name}-%{unmangled_version} -n %{name}-%{unmangled_version}

%build
python3 setup.py build

%install
python3 setup.py install --single-version-externally-managed -O1 --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES

%clean
rm -rf $RPM_BUILD_ROOT

%files -f INSTALLED_FILES
%defattr(-,root,root)

When installing the rpm package though sudo, the root-owner dependencies might cause some damage (friends told me to never use sudo pip install).

In any case, with next release of duden, I can include an rpm file too (maybe with a warning).