From 248f59cbd17f2599abb363270574ebd9f4b3cc35 Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Tue, 21 Feb 2017 16:59:14 -0800 Subject: [PATCH] Renamed 'resources' to 'share', and updated location of 'share' files in OSX/Win binaries --- install/build_deb.sh | 2 +- install/build_rpm.sh | 2 +- install/ppa_release.sh | 2 +- install/pyinstaller.spec | 14 +++++++------- onionshare/helpers.py | 10 +++++----- setup.py | 10 +++++----- {resources => share}/html/404.html | 0 {resources => share}/html/denied.html | 0 {resources => share}/html/index.html | 0 {resources => share}/images/drop_files.png | Bin {resources => share}/images/logo.png | Bin {resources => share}/images/server_started.png | Bin {resources => share}/images/server_stopped.png | Bin {resources => share}/images/server_working.png | Bin {resources => share}/license.txt | 0 {resources => share}/locale/cs.json | 0 {resources => share}/locale/de.json | 0 {resources => share}/locale/en.json | 0 {resources => share}/locale/eo.json | 0 {resources => share}/locale/es.json | 0 {resources => share}/locale/fi.json | 0 {resources => share}/locale/fr.json | 0 {resources => share}/locale/it.json | 0 {resources => share}/locale/nl.json | 0 {resources => share}/locale/no.json | 0 {resources => share}/locale/pt.json | 0 {resources => share}/locale/ru.json | 0 {resources => share}/locale/tr.json | 0 {resources => share}/version.txt | 0 {resources => share}/wordlist.txt | 0 30 files changed, 20 insertions(+), 20 deletions(-) rename {resources => share}/html/404.html (100%) rename {resources => share}/html/denied.html (100%) rename {resources => share}/html/index.html (100%) rename {resources => share}/images/drop_files.png (100%) rename {resources => share}/images/logo.png (100%) rename {resources => share}/images/server_started.png (100%) rename {resources => share}/images/server_stopped.png (100%) rename {resources => share}/images/server_working.png (100%) rename {resources => share}/license.txt (100%) rename {resources => share}/locale/cs.json (100%) rename {resources => share}/locale/de.json (100%) rename {resources => share}/locale/en.json (100%) rename {resources => share}/locale/eo.json (100%) rename {resources => share}/locale/es.json (100%) rename {resources => share}/locale/fi.json (100%) rename {resources => share}/locale/fr.json (100%) rename {resources => share}/locale/it.json (100%) rename {resources => share}/locale/nl.json (100%) rename {resources => share}/locale/no.json (100%) rename {resources => share}/locale/pt.json (100%) rename {resources => share}/locale/ru.json (100%) rename {resources => share}/locale/tr.json (100%) rename {resources => share}/version.txt (100%) rename {resources => share}/wordlist.txt (100%) diff --git a/install/build_deb.sh b/install/build_deb.sh index 8c4d487f..05a37822 100755 --- a/install/build_deb.sh +++ b/install/build_deb.sh @@ -3,7 +3,7 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )" cd $DIR -VERSION=`cat resources/version.txt` +VERSION=`cat share/version.txt` # clean up from last build rm -r deb_dist >/dev/null 2>&1 diff --git a/install/build_rpm.sh b/install/build_rpm.sh index 7be77bb1..89b85586 100755 --- a/install/build_rpm.sh +++ b/install/build_rpm.sh @@ -3,7 +3,7 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )" cd $DIR -VERSION=`cat resources/version.txt` +VERSION=`cat share/version.txt` # clean up from last build rm -r build dist >/dev/null 2>&1 diff --git a/install/ppa_release.sh b/install/ppa_release.sh index e64fb866..cb1a4cdb 100755 --- a/install/ppa_release.sh +++ b/install/ppa_release.sh @@ -7,7 +7,7 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )" cd $DIR -VERSION=`cat resources/version.txt` +VERSION=`cat share/version.txt` rm -rf deb_dist >/dev/null 2>&1 python3 setup.py --command-packages=stdeb.command sdist_dsc diff --git a/install/pyinstaller.spec b/install/pyinstaller.spec index 3c5c19bf..3c5a7fe0 100644 --- a/install/pyinstaller.spec +++ b/install/pyinstaller.spec @@ -3,19 +3,19 @@ import platform p = platform.system() -version = open('resources/version.txt').read().strip() +version = open('share/version.txt').read().strip() a = Analysis( ['scripts/onionshare-gui'], pathex=['.'], binaries=None, datas=[ - ('../resources/images/*', 'images'), - ('../resources/locale/*', 'locale'), - ('../resources/html/*', 'html'), - ('../resources/license.txt', '.'), - ('../resources/version.txt', '.'), - ('../resources/wordlist.txt', '.') + ('../share/license.txt', 'share'), + ('../share/version.txt', 'share'), + ('../share/wordlist.txt', 'share') + ('../share/images/*', 'share/images'), + ('../share/locale/*', 'share/locale'), + ('../share/html/*', 'share/html'), ], hiddenimports=[], hookspath=[], diff --git a/onionshare/helpers.py b/onionshare/helpers.py index 1ba21ed6..a7873942 100644 --- a/onionshare/helpers.py +++ b/onionshare/helpers.py @@ -37,21 +37,21 @@ def get_resource_path(filename): if getattr(sys, 'onionshare_dev_mode', False): # Look for resources directory relative to python file - resources_dir = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))), 'resources') + prefix = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))), 'share') elif p == 'Linux' and sys.argv and sys.argv[0].startswith(sys.prefix): # OnionShare is installed systemwide in Linux - resources_dir = os.path.join(sys.prefix, 'share/onionshare') + prefix = os.path.join(sys.prefix, 'share/onionshare') elif getattr(sys, 'frozen', False): # Check if app is "frozen" # https://pythonhosted.org/PyInstaller/#run-time-information if p == 'Darwin': - resources_dir = sys._MEIPASS + prefix = os.path.join(sys._MEIPASS, 'share') elif p == 'Windows': - resources_dir = os.path.join(os.path.dirname(sys.executable), 'resources') + prefix = os.path.join(os.path.dirname(sys.executable), 'share') - return os.path.join(resources_dir, filename) + return os.path.join(prefix, filename) def get_version(): diff --git a/setup.py b/setup.py index 87ce1889..dcbe42fb 100644 --- a/setup.py +++ b/setup.py @@ -29,7 +29,7 @@ def file_list(path): files.append(os.path.join(path, filename)) return files -version = open('resources/version.txt').read().strip() +version = open('share/version.txt').read().strip() description = ( """OnionShare lets you securely and anonymously share a file of any size with someone. """ """It works by starting a web server, making it accessible as a Tor hidden service, """ @@ -58,10 +58,10 @@ setup( (os.path.join(sys.prefix, 'share/applications'), ['install/onionshare.desktop']), (os.path.join(sys.prefix, 'share/appdata'), ['install/onionshare.appdata.xml']), (os.path.join(sys.prefix, 'share/pixmaps'), ['install/onionshare80.xpm']), - (os.path.join(sys.prefix, 'share/onionshare'), file_list('resources')), - (os.path.join(sys.prefix, 'share/onionshare/images'), file_list('resources/images')), - (os.path.join(sys.prefix, 'share/onionshare/locale'), file_list('resources/locale')), - (os.path.join(sys.prefix, 'share/onionshare/html'), file_list('resources/html')), + (os.path.join(sys.prefix, 'share/onionshare'), file_list('share')), + (os.path.join(sys.prefix, 'share/onionshare/images'), file_list('share/images')), + (os.path.join(sys.prefix, 'share/onionshare/locale'), file_list('share/locale')), + (os.path.join(sys.prefix, 'share/onionshare/html'), file_list('share/html')), ('/usr/share/nautilus-python/extensions/', ['install/scripts/onionshare-nautilus.py']) ] ) diff --git a/resources/html/404.html b/share/html/404.html similarity index 100% rename from resources/html/404.html rename to share/html/404.html diff --git a/resources/html/denied.html b/share/html/denied.html similarity index 100% rename from resources/html/denied.html rename to share/html/denied.html diff --git a/resources/html/index.html b/share/html/index.html similarity index 100% rename from resources/html/index.html rename to share/html/index.html diff --git a/resources/images/drop_files.png b/share/images/drop_files.png similarity index 100% rename from resources/images/drop_files.png rename to share/images/drop_files.png diff --git a/resources/images/logo.png b/share/images/logo.png similarity index 100% rename from resources/images/logo.png rename to share/images/logo.png diff --git a/resources/images/server_started.png b/share/images/server_started.png similarity index 100% rename from resources/images/server_started.png rename to share/images/server_started.png diff --git a/resources/images/server_stopped.png b/share/images/server_stopped.png similarity index 100% rename from resources/images/server_stopped.png rename to share/images/server_stopped.png diff --git a/resources/images/server_working.png b/share/images/server_working.png similarity index 100% rename from resources/images/server_working.png rename to share/images/server_working.png diff --git a/resources/license.txt b/share/license.txt similarity index 100% rename from resources/license.txt rename to share/license.txt diff --git a/resources/locale/cs.json b/share/locale/cs.json similarity index 100% rename from resources/locale/cs.json rename to share/locale/cs.json diff --git a/resources/locale/de.json b/share/locale/de.json similarity index 100% rename from resources/locale/de.json rename to share/locale/de.json diff --git a/resources/locale/en.json b/share/locale/en.json similarity index 100% rename from resources/locale/en.json rename to share/locale/en.json diff --git a/resources/locale/eo.json b/share/locale/eo.json similarity index 100% rename from resources/locale/eo.json rename to share/locale/eo.json diff --git a/resources/locale/es.json b/share/locale/es.json similarity index 100% rename from resources/locale/es.json rename to share/locale/es.json diff --git a/resources/locale/fi.json b/share/locale/fi.json similarity index 100% rename from resources/locale/fi.json rename to share/locale/fi.json diff --git a/resources/locale/fr.json b/share/locale/fr.json similarity index 100% rename from resources/locale/fr.json rename to share/locale/fr.json diff --git a/resources/locale/it.json b/share/locale/it.json similarity index 100% rename from resources/locale/it.json rename to share/locale/it.json diff --git a/resources/locale/nl.json b/share/locale/nl.json similarity index 100% rename from resources/locale/nl.json rename to share/locale/nl.json diff --git a/resources/locale/no.json b/share/locale/no.json similarity index 100% rename from resources/locale/no.json rename to share/locale/no.json diff --git a/resources/locale/pt.json b/share/locale/pt.json similarity index 100% rename from resources/locale/pt.json rename to share/locale/pt.json diff --git a/resources/locale/ru.json b/share/locale/ru.json similarity index 100% rename from resources/locale/ru.json rename to share/locale/ru.json diff --git a/resources/locale/tr.json b/share/locale/tr.json similarity index 100% rename from resources/locale/tr.json rename to share/locale/tr.json diff --git a/resources/version.txt b/share/version.txt similarity index 100% rename from resources/version.txt rename to share/version.txt diff --git a/resources/wordlist.txt b/share/wordlist.txt similarity index 100% rename from resources/wordlist.txt rename to share/wordlist.txt