Skip to content

Commit

Permalink
More trying to fix Cirrus CI issues
Browse files Browse the repository at this point in the history
  • Loading branch information
BGR360 committed Oct 21, 2019
1 parent bd8614b commit 829540e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ task:
fetch_git_tags_script: git fetch --tags
install_script: python setup.py install
version_script: self-updating-app --version
test_script: self-updating-app
test_script: self-updating-app --no-update

task:
name: Test Install from GitHub
Expand Down
15 changes: 9 additions & 6 deletions app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
class SelfUpdatingApp():
'''A self-updating application :O'''

def __init__(self):
def __init__(self, no_update=False):
self.no_update = no_update
# Fetch most recent version from GitHub repository
self.remote_version = SemanticVersion.from_pip_string(
get_latest_version_string_from_github_repo())
Expand Down Expand Up @@ -76,9 +77,11 @@ def prompt_yes_or_no(self, prompt=None, default=None):
print('Please respond with "yes" or "no" (or "y" or "n").')

def run(self):
if self.is_out_of_date():
print('There is a new version available (v{}).'.format(
self.remote_version.release_string()))
if self.prompt_yes_or_no('Would you like to update?', default=True):
self.update()
print('Local version = {}'.print(self.local_version.release_string()))
if not self.no_update:
if self.is_out_of_date():
print('There is a new version available (v{}).'.format(
self.remote_version.release_string()))
if self.prompt_yes_or_no('Would you like to update?', default=True):
self.update()
print('Hello world!')
6 changes: 4 additions & 2 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@
# Allow the user to install a specific version with --install-version
@click.option('--install-version',
help='Install a specific version of the program (for testing).')
@click.option('-n', '--no-update', is_flag=True,
help='Do not check for updates.')
# Print version using --version (autodetected from setuptools)
@click.version_option()
@click.help_option('-h', '--help')
def main(install_version):
self_updating_app = SelfUpdatingApp()
def main(install_version, no_update):
self_updating_app = SelfUpdatingApp(no_update=no_update)

if install_version:
print('Installing version {}'.format(install_version))
Expand Down

0 comments on commit 829540e

Please sign in to comment.