Add entry point script

This commit is contained in:
Terje Røsten 2016-09-20 19:34:00 +02:00
parent d365317a16
commit f25ef62b20
3 changed files with 47 additions and 42 deletions

View File

@ -1,5 +0,0 @@
#! /bin/bash
#
python -m pyinotify "$@"

View File

@ -0,0 +1,11 @@
diff --git a/setup.py b/setup.py
index 15d68ab..cf6dc5b 100755
--- a/setup.py
+++ b/setup.py
@@ -115,4 +115,6 @@ setup(
ext_modules=ext_mod,
py_modules=['pyinotify'],
package_dir=package_dir,
+ entry_points = { 'console_scripts' :
+ [ 'pyinotify = pyinotify:command_line', ] },
)

View File

@ -1,20 +1,17 @@
%global with_python3 1
%global oname pyinotify
Summary: Monitor filesystem events with Python under Linux
Name: python-inotify
Version: 0.9.6
Release: 5%{?dist}
Release: 6%{?dist}
License: MIT
Group: Development/Libraries
URL: https://github.com/seb-m/pyinotify
Source0: http://seb.dbzteam.org/pub/pyinotify/releases/pyinotify-%{version}.tar.gz
Source1: %{oname}
Patch01: pyinotify-0.9.6-epoint.patch
BuildRequires: python-devel
BuildRequires: gmp-devel
%if 0%{?with_python3}
BuildRequires: python3-devel
%endif
BuildArch: noarch
%description
@ -24,18 +21,31 @@ recent Linux Kernel feature (merged in kernel 2.6.13) called
inotify. inotify is an event-driven notifier, its notifications are
exported from kernel space to user space.
%package examples
%package -n python2-inotify
Summary: Monitor filesystem events with Python under Linux
Group: Development/Languages
%{?python_provide:%python_provide python2-inotify}
%description -n python2-inotify
This is a Python 2 module for watching filesystems changes. pyinotify
can be used for various kind of fs monitoring. pyinotify relies on a
recent Linux Kernel feature (merged in kernel 2.6.13) called
inotify. inotify is an event-driven notifier, its notifications are
exported from kernel space to user space.
%package -n python2-inotify-examples
Summary: Examples for Python inotify module
Group: Development/Libraries
Requires: python-inotify = %{version}-%{release}
Requires: python2-inotify = %{version}-%{release}
%{?python_provide:%python_provide python2-inotify-examples}
%description examples
%description -n python2-inotify-examples
This package includes some examples usage of the Python inotify module.
%if 0%{?with_python3}
%package -n python3-inotify
Summary: Monitor filesystem events with Python under Linux
Group: Development/Languages
%{?python_provide:%python_provide python3-inotify}
%description -n python3-inotify
This is a Python 3 module for watching filesystems changes. pyinotify
@ -44,61 +54,50 @@ recent Linux Kernel feature (merged in kernel 2.6.13) called
inotify. inotify is an event-driven notifier, its notifications are
exported from kernel space to user space.
This is the Python 3 build of pyinotify
%endif # if with_python3
%prep
%setup -q -n %{oname}-%{version}
%if 0%{?with_python3}
%{__rm} -rf %{py3dir}
%patch01 -p1
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif
%build
%{__python2} setup.py build
%if 0%{?with_python3}
%py2_build
pushd %{py3dir}
%{__python3} setup.py build
%py3_build
popd
%endif
%install
# Install python 3 first, so that python 2 gets precedence:
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install -O1 --skip-build --root %{buildroot}
install -D -m 0755 -p %{SOURCE1} %{buildroot}%{_bindir}/python3-%{oname}
sed -i -e 's/^python /python3 /' %{buildroot}%{_bindir}/python3-%{oname}
chmod 0755 %{buildroot}%{python3_sitelib}/%{oname}.py
%py3_install
mv %{buildroot}%{_bindir}/%{oname} %{buildroot}%{_bindir}/python3-%{oname}
popd
%endif
%{__python2} setup.py install -O1 --skip-build --root %{buildroot}
install -D -m 0755 -p %{SOURCE1} %{buildroot}%{_bindir}/%{oname}
chmod 0755 %{buildroot}%{python_sitelib}/%{oname}.py
%py2_install
# examples
install -d -m 0755 %{buildroot}%{_datadir}/%{oname}
cp -a python2/examples/* %{buildroot}%{_datadir}/%{oname}
%files
%doc ACKS COPYING README.md
%files -n python2-inotify
%license COPYING
%doc ACKS README.md
%{_bindir}/%{oname}
%{python_sitelib}/%{oname}*
%files examples
%files -n python2-inotify-examples
%license COPYING
%{_datadir}/%{oname}
%if 0%{?with_python3}
%files -n python3-inotify
%doc ACKS COPYING README.md
%license COPYING
%doc ACKS README.md
%{_bindir}/python3-%{oname}
%{python3_sitelib}/%{oname}*
%{python3_sitelib}/__pycache__/%{oname}*
%endif
%changelog
* Tue Sep 20 2016 Terje Rosten <terje.rosten@ntnu.no> - 0.9.6-6
- Add entry point script
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.6-5
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages