From 4419674cbd851e0ef4982ecdc647de37ae5aebe2 Mon Sep 17 00:00:00 2001 From: o355 Date: Mon, 31 Jul 2017 22:26:05 -0400 Subject: [PATCH] Final 0.6.1 beta commit --- .gitignore | 1 - CHANGELOG.md | 4 +- configupdate.py | 5 +- keybackup.py | 127 --------------------------------------- pyweather.py | 6 +- setup.py | 6 +- storage/config_README.md | 69 +++++++++++++++++++-- updater.py | 4 +- 8 files changed, 79 insertions(+), 143 deletions(-) delete mode 100644 keybackup.py diff --git a/.gitignore b/.gitignore index 0c23ff7..ed0daa5 100644 --- a/.gitignore +++ b/.gitignore @@ -123,5 +123,4 @@ storage/config.ini storage/versioninfo.txt # DS Store file -.DS_Store *.DS_Store \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 914b94f..939c076 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,7 +17,7 @@ The changelog will now NOT BE used for tracking what needs to get done, and not * Docs folder for uh, documents. * Adds the option to force a scheme on Geopy (HTTP or HTTPS) -## version 0.6.1 beta - Performing QA - Should be released by 7/31/2017 +## version 0.6.1 beta - Released on 7/31/2017 **NEW FEATURES/REMOVALS** * Adds caching and refreshing to PyWeather. After a user-defined amount of time, a cache will expire for certain components of PyWeather, prompting a re-fetch of data. A manual refresh option will also get added, in which a flag is enabled to refresh the cache. * Removed the dependency on geocoder, and by extension, removed the unnecessary reverse geocoder, and @@ -31,8 +31,8 @@ The changelog will now NOT BE used for tracking what needs to get done, and not * PyWeather Setup now validates your API key after you input it (and after the backup) * PyWeather Setup will now update PIP packages with user approval. * Geopy's scheme was changed to HTTP due to issues on OS X. -* Added the ability to back up your API key to a specific directory in the keybackup.py script. - 0% done * Adds wind direction data to historical hourly. +* Removed the keybackup script. **BUG FIXES** * Fixed a major bug where the PyWeather Git updater wouldn't, uh, fully update. diff --git a/configupdate.py b/configupdate.py index fb95953..b1761db 100644 --- a/configupdate.py +++ b/configupdate.py @@ -30,7 +30,7 @@ except: print("Failed to add the cache section. Does it exist?") - print("7 new configuration options have been added.", + print("9 new configuration options have been added.", "Details:", "- CACHE/alerts_cachedtime - Sets the cache time on alert data - Defaults to 5", "- CACHE/current_cachedtime - Sets the cache time on current data - Defaults to 10", @@ -67,6 +67,9 @@ "the full error. Along with that, please manually add the configuration entries", "as listed above, with their default values in your configuration file.", "Press enter to exit.") + input() + sys.exit() + open("updater//versioninfo.txt", 'w').close() with open("updater//versioninfo.txt", 'a') as out: out.write("0.6.1 beta") diff --git a/keybackup.py b/keybackup.py deleted file mode 100644 index 2fda231..0000000 --- a/keybackup.py +++ /dev/null @@ -1,127 +0,0 @@ -# PyWeather API Key Backup - version 0.6.0.1 beta -# (c) 2017, o355, GNU GPL 3.0 - -import configparser -import sys -import logging -import traceback - -# Try loading the versioninfo.txt file. If it isn't around, create the file with -# the present version info. - -try: - versioninfo = open('updater//versioninfo.txt') -except: - open('updater//versioninfo.txt', 'w').close() - with open("updater//versioninfo.txt", 'a') as out: - out.write("0.6.0.1 beta") - out.close() - -# See if the config is "provisioned". If it isn't, a KeyError will occur, -# because it's not created. Creative. -try: - configprovisioned = config.getboolean('USER', 'configprovisioned') -except: - print("We ran into an error. Full traceback below.") - traceback.print_exc() - # Not doing a separate script launch. Doing sys.exit in that script would just continue - # PyWeather. We ask the user to run the script themselves. - print("This isn't good. Your config file isn't provisioned.", - "If you're new to PyWeather, you should run the setup script.", - "Otherwise, try launching configsetup.py, which is available in the", - "storage folder. Press enter to exit.", sep="\n") - input() - sys.exit() - -config = configparser.ConfigParser() -config.read('storage//config.ini') - -try: - verbosity = config.getboolean('VERBOSITY', 'keybackup_verbosity') - saveDirectory = config.get('KEYBACKUP', 'savedirectory') - tracebacksEnabled = config.getboolean('TRACEBACK', 'keybackup_tracebacks') -except: - print("Couldn't load your config file. Make sure there aren't any typos", - "in the config, and that the config file is accessible.", - "Setting config variables to their defaults.", - "Here's the full traceback, in case you need it.", sep="\n") - traceback.print_exc() - verbosity = False - saveDirectory = 'backup//backkey.txt' - tracebacksEnabled = False - -logger = logging.getLogger(name='pyweather_keybackup_0.6.0.1beta') -logformat = '%(asctime)s | %(levelname)s | %(message)s' -logging.basicConfig(format=logformat) - -if verbosity == True: - logger.setLevel(logging.DEBUG) -elif tracebacksEnabled == True: - logger.setLevel(logging.ERROR) -else: - logger.setLevel(logging.CRITICAL) - -def printException(): - if tracebacksEnabled == True: - print("Here's the full traceback:") - traceback.print_exc() - -logger.debug("Listing configuration options:") -logger.debug("verbosity: %s ; saveDirectory: %s" % - (verbosity, saveDirectory)) -logger.debug("tracebacksEnabled: %s" % - (tracebacksEnabled)) - -print("Would you like to back up your API key?") -confirmation = input("Input here: ").lower() -logger.debug("confirmation: %s" % confirmation) -if confirmation == "yes": - logger.info("Selected yes - Backup key") - print("Backing up your key.") - apikey = open('storage//apikey.txt') - apikey2 = apikey.read() - saveLocation = saveDirectory + "backkey.txt" - try: - open(saveLocation, 'w').close() - except: - print("We ran into an error when overwriting a possibly existing file.", - "Please try again, and make sure your config file has the right spelling", - "under the option for the backup directory. Furthermore, make sure that the", - "backup directory specified in the config file has proper permissions.", sep="\n") - printException() - print("Press enter to exit.") - input() - sys.exit() - logger.debug("apikey: %s" % apikey) - logger.debug("Performed op: Delete %s" % saveLocation) - try: - with open(saveLocation, 'a') as out: - logger.debug("out: %s" % out) - out.write(apikey2) - out.close() - logger.debug("Performed ops: out.write(apikey2), out.close()") - except: - print("We ran into an error when writing to the backup key text file.", - "Please try again, and make sure your config file has the right spelling", - "under the option for the backup directory. Furthermore, make sure that the", - "backup directory specified in the config has proper permissions.",sep="\n") - printException() - print("Press enter to exit.") - input() - sys.exit() - print("Done!") - print("Press enter to exit.") - input() - sys.exit() -elif confirmation == "no": - logger.info("Selected no - do not back up API key.") - print("No changes will be made. Now closing.") - print("Press enter to exit.") - input() - sys.exit() -else: - logger.info("Couldn't understand input.") - print("Couldn't understand your input. Closing as a precaution...") - print("Press enter to exit.") - input() - sys.exit() diff --git a/pyweather.py b/pyweather.py index d81f721..fb02c1b 100644 --- a/pyweather.py +++ b/pyweather.py @@ -163,7 +163,7 @@ # Import logging, and set up the logger. import logging -logger = logging.getLogger(name='pyweather_0.6beta') +logger = logging.getLogger(name='pyweather_0.6.1beta') logformat = '%(asctime)s | %(levelname)s | %(message)s' logging.basicConfig(format=logformat) @@ -177,7 +177,7 @@ logger.setLevel(logging.CRITICAL) # List config options for those who have verbosity enabled. -logger.info("PyWeather 0.6 indev now starting.") +logger.info("PyWeather 0.6.1 beta now starting.") logger.info("Configuration options are as follows: ") logger.debug("sundata_summary: %s ; almanac_summary: %s" % (sundata_summary, almanac_summary)) @@ -404,7 +404,7 @@ def radar_clearImages(): logger.info("Defining about variables...") about_buildnumber = "61" about_version = "0.6.1 beta" -about_releasedate = "May 29, 2017" +about_releasedate = "July 31, 2017" about_maindevelopers = "o355" logger.debug("about_buildnumber: %s ; about_version: %s" % (about_buildnumber, about_version)) diff --git a/setup.py b/setup.py index 8cc5514..d9ac1a5 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,4 @@ -# PyWeather Setup - version 0.6.0.1 beta +# PyWeather Setup - version 0.6.1 beta # (c) 2017, o355, licensed under GNU GPL v3 # Same deal as the main script. @@ -33,7 +33,7 @@ except: open('updater//versioninfo.txt', 'w').close() with open("updater//versioninfo.txt", 'a') as out: - out.write("0.6.0.1 beta") + out.write("0.6.1 beta") out.close() config = configparser.ConfigParser() @@ -430,7 +430,7 @@ def printException_loggerwarn(): "I'll start in a few seconds.", sep="\n") time.sleep(3) print("Downloading the installer...") - # We use the built-in + # We use the built-in urllib library, as some Python installs don't include requests. try: with urllib.request.urlopen('https://bootstrap.pypa.io/get-pip.py') as update_response, open('get-pip.py', 'wb') as update_out_file: diff --git a/storage/config_README.md b/storage/config_README.md index 953ecb7..11fc2d6 100644 --- a/storage/config_README.md +++ b/storage/config_README.md @@ -231,10 +231,10 @@ When doing this, custom changes to your config file will be overwritten. PyWeath **Default option: False** ## RADAR GUI section -**Available in PyWeather 0.6 indev, and PyWeather 0.6.1 beta and above** +**Available in PyWeather 0.6.1 beta and above** This section controls the GUI for displaying radar and other images. -### gifsize +### radar_imagesize This option allows you to control the size of the .gif image that is to be displayed. This option will only accept 5 sizes, as defined below (can't imagine how hard it'd be to code in every size ever. This is simpler, too) @@ -251,6 +251,13 @@ Of course, on newer laptops with FHD screens, you can increase the resolution of **Default option: normal** +## bypassconfirmation +This option allows you to control if the warning about the radar being experimental can be bypassed. + +When this option is True, the confirmation is bypassed. + +**Default option: False** + ## KEYBACKUP section This section allows you to control parts of the Key Backup script. @@ -290,7 +297,7 @@ v1.1 = 110 And so on and so forth. -If a criticial hotfix needs to be applied (e.g. 0.5.2.1), the build number in such case would become 52.1. +If a critical hotfix needs to be applied (e.g. 0.5.2.1), the build number in such case would become 52.1. **Default option: 52.1** @@ -309,4 +316,58 @@ This option controls if your config file is provisioned. This mainly does nothin Changing this should do nothing, but keep it True just to be safe. -**Default option: True** \ No newline at end of file +**Default option: True** + +## CACHE section +**Available in PyWeather 0.6.1 beta and above** + +This section lets you control cache times for the new caching system, and a master switch. + +### enabled +This option lets you control if the cache is enabled (True), or disabled (False) + +**Default option: True** + +### alerts_cachedtime +This option lets you control how many minutes will pass until alerts data is refreshed. + +This option must be an integer or float. + +**Default option: 5** + +### current_cachedtime +This option lets you control how many minutes will pass until current "currently" weather data is refreshed. + +This option must be an integer or float. + +**Default option: 10** + +### hourly_cachedtime +This option lets you control how many minutes will pass until hourly weather data is refreshed. + +This option must be an integer or float. + +**Default option: 60** + +### forecast_cachedtime +This option lets you control how many minutes will pass until forecast weather data is refreshed. + +Keeping this option at 60 is recommended, since forecasts can change rapidly. + +This option must be an integer or float. + +**Default option: 60** + +### almanac_cachedtime +This option lets you control how many minutes will pass until almanac data is refreshed. + +This option must be an integer or float. + +**Default option: 240** + +### sundata_cachedtime +This option lets you control how many minutes will pass until sunrise/sunset data is refreshed. + +This option must be an integer or float. + +**Default option: 480** \ No newline at end of file diff --git a/updater.py b/updater.py index 152cb6e..217c00b 100644 --- a/updater.py +++ b/updater.py @@ -119,8 +119,8 @@ def printException_loggerwarn(): logger.debug("showReleaseNotes: %s" % (showReleaseNotes)) -buildnumber = 60.1 -buildversion = "0.6.0.1 beta" +buildnumber = 61 +buildversion = "0.6.1 beta" logger.debug("buildnumber: %s ; buildversion: %s" % (buildnumber, buildversion))