diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..61772f9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*airnef*/ +noarch/ diff --git a/airnef-1.1-rpm-paths.patch b/airnef-1.1-rpm-paths.patch new file mode 100644 index 0000000..b337caf --- /dev/null +++ b/airnef-1.1-rpm-paths.patch @@ -0,0 +1,51 @@ +diff --git a/airnef.pyw b/airnef.pyw +index 45e57b5..572914f 100644 +--- a/airnef.pyw ++++ b/airnef.pyw +@@ -1216,19 +1216,7 @@ def establishAppEnvironment(): + # and configuration files. For Win32 if we're frozen this + # goes in the dedicated OS area for application data files + # +- g.appDataDir = None +- if g.isFrozen and g.isWin32: +- if os.getenv('LOCALAPPDATA'): +- g.appDataDir = os.path.join(os.getenv('LOCALAPPDATA'), "airnef\\appdata") # typically C:\Users\\AppData\Local\airnef\appdata +- elif g.isOSX: # for OSX we always try to store our app data under Application Support +- userHomeDir = os.getenv('HOME') +- if userHomeDir: +- applicationSupportDir = os.path.join(userHomeDir, 'Library/Application Support') +- if os.path.exists(applicationSupportDir): # probably not necessary to check existence since every system should have this directory +- g.appDataDir = os.path.join(applicationSupportDir, 'airnef/appdata') +- if not g.appDataDir: +- # none of runtime-specific cases above selected an app data directory - use directory based off our app directory +- g.appDataDir = os.path.join(g.appDir, "appdata") ++ g.appDataDir = os.path.join(os.getenv('HOME'), '.local', 'airnef') + # create our app-specific subdirectories if necessary + if not os.path.exists(g.appDataDir): + os.makedirs(g.appDataDir) +diff --git a/airnefcmd.py b/airnefcmd.py +index 1139ae4..8f38257 100644 +--- a/airnefcmd.py ++++ b/airnefcmd.py +@@ -444,19 +444,8 @@ def establishAppEnvironment(): + # and configuration files. For Win32 if we're frozen this + # goes in the dedicated OS area for application data files + # +- g.appDataDir = None +- if g.isFrozen and g.isWin32: +- if os.getenv('LOCALAPPDATA'): +- g.appDataDir = os.path.join(os.getenv('LOCALAPPDATA'), "airnef\\appdata") # typically C:\Users\\AppData\Local\airnef\appdata +- elif g.isOSX: # for OSX we always try to store our app data under Application Support +- userHomeDir = os.getenv('HOME') +- if userHomeDir: +- applicationSupportDir = os.path.join(userHomeDir, 'Library/Application Support') +- if os.path.exists(applicationSupportDir): # probably not necessary to check existence since every system should have this directory +- g.appDataDir = os.path.join(applicationSupportDir, 'airnef/appdata') +- if not g.appDataDir: +- # none of runtime-specific cases above selected an app data directory - use directory based off our app directory +- g.appDataDir = os.path.join(g.appDir, "appdata") ++ g.appDataDir = os.path.join(os.getenv('HOME'), '.local', 'airnef') ++ + # create our app-specific subdirectories if necessary + if not os.path.exists(g.appDataDir): + os.makedirs(g.appDataDir) diff --git a/airnef.spec b/airnef.spec new file mode 100644 index 0000000..df9c351 --- /dev/null +++ b/airnef.spec @@ -0,0 +1,92 @@ +%if 0%{?rhel} && 0%{?rhel} <= 7 +%global python python2 +%global appdir %python2_sitelib/%name +%global appresdir %python2_sitelib/%name/appresource +%else +%global python python3 +%global appdir %python3_sitelib/%name +%global appresdir %python3_sitelib/%name/appresource +%endif + + +Name: airnef +Version: 1.1 +Release: 1%{?dist} +Summary: Wireless download from your Nikon/Canon Camera! + +License: GPLv3 +URL: http://www.testcams.com/airnef/ +BuildArch: noarch +Source0: http://www.testcams.com/airnef/Version_%{version}/airnef_v%{version}_Source.zip + +Patch0: airnef-1.1-rpm-paths.patch + +BuildRequires: %python-devel + +Requires: %python-six + +%description +Open-source utility for downloading images and videos from WiFi-equipped +cameras. Airnef supports all Nikon cameras that have built-in WiFi interfaces, +along with those using external Nikon WU-1a and WU-1b WiFi adapters, Canon and +Sony cameras. + + +%prep +%autosetup -p1 -n airnef + +# six is available in fedora +rm six.py + +# OSX only file is not needed +rm airnefcmd_OSX_Frozen_Wrapper.py + +# TODO: ?? +rm appresource/airnef.icns + + +%build + + +%install + +mkdir -p %buildroot%appdir +for i in *.py *.pyw; do + dest=${i/%pyw/py} # drop pyw suffixes + install "$i" -p -m 644 %buildroot%appdir/"$dest" +done + +mkdir -p %buildroot%appresdir +for i in appresource/*; do + install "$i" -p -m 644 %buildroot%appresdir +done + +cat > wrapper <<'EOF' +#! /bin/sh +exec %python %appdir/"$(basename "$0").py" "$@" +EOF + +mkdir -p %buildroot%_bindir +install -m 755 wrapper %buildroot%_bindir/airnef +install -m 755 wrapper %buildroot%_bindir/airnefcmd + + +%files +%doc +%_bindir/* +%appdir/*.py +%if %python == python3 +%appdir/__pycache__ +%else +%appdir/*.pyo +%appdir/*.pyc +%endif +%appresdir/*.ico +%appresdir/*.gif +%appresdir/*.xbm + + + +%changelog +* Tue May 29 2018 Pavel Raiskup - 1.1-1 +- initial RPM packaging