forked from endorphant/ttbp
adding build switching utility
now there's an annotation in the __version__ for beta; added a check on program start to see if the user is switching between beta and stable, and switches accordingly. patching updates should still work as usual.
This commit is contained in:
parent
946f73290b
commit
82cbcd535c
42
bin/_ttbp.py
42
bin/_ttbp.py
@ -40,9 +40,8 @@ import chatter
|
|||||||
import inflect
|
import inflect
|
||||||
import util
|
import util
|
||||||
|
|
||||||
__version__ = "0.9.0"
|
__version__ = "0.9.0b"
|
||||||
__author__ = "endorphant <endorphant@tilde.town)"
|
__author__ = "endorphant <endorphant@tilde.town)"
|
||||||
#__name__ = "_ttpb: wip/beta version of the ttbp console interface"
|
|
||||||
|
|
||||||
## system globals
|
## system globals
|
||||||
SOURCE = os.path.join("/home", "endorphant", "projects", "ttbp", "bin")
|
SOURCE = os.path.join("/home", "endorphant", "projects", "ttbp", "bin")
|
||||||
@ -164,6 +163,8 @@ def check_init():
|
|||||||
setup_handler()
|
setup_handler()
|
||||||
|
|
||||||
## PATCH CHECK HERE
|
## PATCH CHECK HERE
|
||||||
|
if build_mismatch():
|
||||||
|
switch_build()
|
||||||
if not updated():
|
if not updated():
|
||||||
update_version()
|
update_version()
|
||||||
|
|
||||||
@ -907,6 +908,41 @@ def make_publish_dir(dir):
|
|||||||
|
|
||||||
##### PATCHING UTILITIES
|
##### PATCHING UTILITIES
|
||||||
|
|
||||||
|
def build_mismatch():
|
||||||
|
'''
|
||||||
|
checks to see if user's last run build is the same as this session
|
||||||
|
'''
|
||||||
|
|
||||||
|
versionFile = os.path.join(PATH, "version")
|
||||||
|
if not os.path.exists(versionFile):
|
||||||
|
return False
|
||||||
|
|
||||||
|
ver = open(versionFile, "r").read()
|
||||||
|
|
||||||
|
if ver[-1] == __version__[-1]:
|
||||||
|
return False
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
def switch_build():
|
||||||
|
'''
|
||||||
|
switches user between beta and stable builds
|
||||||
|
'''
|
||||||
|
|
||||||
|
if __version__[-1] == 'b':
|
||||||
|
build = "beta"
|
||||||
|
else:
|
||||||
|
build = "stable"
|
||||||
|
|
||||||
|
# increment user versionfile
|
||||||
|
print("\nswitching you over to the most current "+build+" version...\n")
|
||||||
|
time.sleep(1)
|
||||||
|
print("...")
|
||||||
|
versionFile = os.path.join(PATH, "version")
|
||||||
|
open(versionFile, "w").write(__version__)
|
||||||
|
time.sleep(2)
|
||||||
|
print("\nall good!\n")
|
||||||
|
|
||||||
def updated():
|
def updated():
|
||||||
'''
|
'''
|
||||||
checks to see if current user is up to the same version as system
|
checks to see if current user is up to the same version as system
|
||||||
@ -914,7 +950,7 @@ def updated():
|
|||||||
|
|
||||||
versionFile = os.path.join(PATH, "version")
|
versionFile = os.path.join(PATH, "version")
|
||||||
if not os.path.exists(versionFile):
|
if not os.path.exists(versionFile):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
ver = open(versionFile, "r").read()
|
ver = open(versionFile, "r").read()
|
||||||
|
|
||||||
|
39
bin/ttbp.py
39
bin/ttbp.py
@ -163,6 +163,8 @@ def check_init():
|
|||||||
setup_handler()
|
setup_handler()
|
||||||
|
|
||||||
## PATCH CHECK HERE
|
## PATCH CHECK HERE
|
||||||
|
if build_mismatch():
|
||||||
|
switch_build()
|
||||||
if not updated():
|
if not updated():
|
||||||
update_version()
|
update_version()
|
||||||
|
|
||||||
@ -904,6 +906,41 @@ def make_publish_dir(dir):
|
|||||||
|
|
||||||
##### PATCHING UTILITIES
|
##### PATCHING UTILITIES
|
||||||
|
|
||||||
|
def build_mismatch():
|
||||||
|
'''
|
||||||
|
checks to see if user's last run build is the same as this session
|
||||||
|
'''
|
||||||
|
|
||||||
|
versionFile = os.path.join(PATH, "version")
|
||||||
|
if not os.path.exists(versionFile):
|
||||||
|
return False
|
||||||
|
|
||||||
|
ver = open(versionFile, "r").read()
|
||||||
|
|
||||||
|
if ver[-1] == __version__[-1]:
|
||||||
|
return False
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
def switch_build():
|
||||||
|
'''
|
||||||
|
switches user between beta and stable builds
|
||||||
|
'''
|
||||||
|
|
||||||
|
if __version__[-1] == 'b':
|
||||||
|
build = "beta"
|
||||||
|
else:
|
||||||
|
build = "stable"
|
||||||
|
|
||||||
|
# increment user versionfile
|
||||||
|
print("\nswitching you over to the most current "+build+" version...\n")
|
||||||
|
time.sleep(1)
|
||||||
|
print("...")
|
||||||
|
versionFile = os.path.join(PATH, "version")
|
||||||
|
open(versionFile, "w").write(__version__)
|
||||||
|
time.sleep(2)
|
||||||
|
print("\nall good!\n")
|
||||||
|
|
||||||
def updated():
|
def updated():
|
||||||
'''
|
'''
|
||||||
checks to see if current user is up to the same version as system
|
checks to see if current user is up to the same version as system
|
||||||
@ -911,7 +948,7 @@ def updated():
|
|||||||
|
|
||||||
versionFile = os.path.join(PATH, "version")
|
versionFile = os.path.join(PATH, "version")
|
||||||
if not os.path.exists(versionFile):
|
if not os.path.exists(versionFile):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
ver = open(versionFile, "r").read()
|
ver = open(versionFile, "r").read()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user