ef87cc2
%if 0%{?rhel} && 0%{?rhel} <= 7
ef87cc2
%global python    python2
ef87cc2
%global appdir    %python2_sitelib/%name
ef87cc2
%global appresdir %python2_sitelib/%name/appresource
ef87cc2
%else
ef87cc2
%global python    python3
ef87cc2
%global appdir    %python3_sitelib/%name
ef87cc2
%global appresdir %python3_sitelib/%name/appresource
ef87cc2
%endif
ef87cc2
ef87cc2
ef87cc2
Name:           airnef
ef87cc2
Version:        1.1
f13be64
Release:        6%{?dist}
a40dc49
Summary:        Wireless download from your Nikon/Canon Camera
ef87cc2
ef87cc2
License:        GPLv3
ef87cc2
URL:            http://www.testcams.com/airnef/
ef87cc2
BuildArch:      noarch
ef87cc2
Source0:        http://www.testcams.com/airnef/Version_%{version}/airnef_v%{version}_Source.zip
ef87cc2
ef87cc2
Patch0:         airnef-1.1-rpm-paths.patch
ef87cc2
ef87cc2
BuildRequires:  %python-devel
ef87cc2
ef87cc2
Requires:       %python-six
f13be64
Requires:       %python-tkinter
ef87cc2
ef87cc2
%description
ef87cc2
Open-source utility for downloading images and videos from WiFi-equipped
ef87cc2
cameras.  Airnef supports all Nikon cameras that have built-in WiFi interfaces,
ef87cc2
along with those using external Nikon WU-1a and WU-1b WiFi adapters, Canon and
ef87cc2
Sony cameras.
ef87cc2
ef87cc2
ef87cc2
%prep
ef87cc2
%autosetup -p1 -n airnef
ef87cc2
ef87cc2
# six is available in fedora
ef87cc2
rm six.py
ef87cc2
ef87cc2
# OSX only file is not needed
ef87cc2
rm airnefcmd_OSX_Frozen_Wrapper.py
ef87cc2
ef87cc2
# TODO: ??
ef87cc2
rm appresource/airnef.icns
ef87cc2
c9d7ca1
for i in `grep -l -r '#!/usr/bin/env python'`; do
c9d7ca1
    sed -i '1 s|#!/usr/bin/env python.*||g' "$i"
c9d7ca1
done
c9d7ca1
ef87cc2
ef87cc2
%build
ef87cc2
ef87cc2
ef87cc2
%install
ef87cc2
mkdir -p %buildroot%appdir
ef87cc2
for i in *.py *.pyw; do
ef87cc2
    dest=${i/%pyw/py} # drop pyw suffixes
ef87cc2
    install "$i" -p -m 644 %buildroot%appdir/"$dest"
ef87cc2
done
ef87cc2
ef87cc2
mkdir -p %buildroot%appresdir
ef87cc2
for i in appresource/*; do
ef87cc2
    install "$i" -p -m 644 %buildroot%appresdir
ef87cc2
done
ef87cc2
ef87cc2
cat > wrapper <<'EOF'
ef87cc2
#! /bin/sh
ef87cc2
exec %python %appdir/"$(basename "$0").py" "$@"
ef87cc2
EOF
ef87cc2
ef87cc2
mkdir -p %buildroot%_bindir
ef87cc2
install -m 755 wrapper %buildroot%_bindir/airnef
ef87cc2
install -m 755 wrapper %buildroot%_bindir/airnefcmd
ef87cc2
ef87cc2
ef87cc2
%files
ef87cc2
%doc
ef87cc2
%_bindir/*
cb9ceb4
%dir %appdir
ef87cc2
%appdir/*.py
ef87cc2
%if %python == python3
ef87cc2
%appdir/__pycache__
ef87cc2
%else
ef87cc2
%appdir/*.pyo
ef87cc2
%appdir/*.pyc
ef87cc2
%endif
cb9ceb4
%dir %appresdir
ef87cc2
%appresdir/*.ico
ef87cc2
%appresdir/*.gif
ef87cc2
%appresdir/*.xbm
ef87cc2
ef87cc2
ef87cc2
ef87cc2
%changelog
f13be64
* Thu Apr 25 2019 Pavel Raiskup <praiskup@redhat.com> - 1.1-6
f13be64
- require python3-tkinter (rhbz#1702714)
f13be64
ab7891b
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.1-5
ab7891b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
ab7891b
6e616c6
* Thu Jul 12 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.1-4
6e616c6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
6e616c6
aeb8bae
* Tue Jun 19 2018 Miro HronĨok <mhroncok@redhat.com> - 1.1-3
aeb8bae
- Rebuilt for Python 3.7
aeb8bae
c9d7ca1
* Wed May 30 2018 Pavel Raiskup <praiskup@redhat.com> - 1.1-2
c9d7ca1
- silent rpmdiff complaints about python shebangs (review rhbz#1583475)
c9d7ca1
ef87cc2
* Tue May 29 2018 Pavel Raiskup <praiskup@redhat.com> - 1.1-1
ef87cc2
- initial RPM packaging