Skip to content

Commit

Permalink
#141: check the latest version using pipdate package
Browse files Browse the repository at this point in the history
  • Loading branch information
kmyk committed Nov 3, 2018
1 parent 02b0e73 commit 22b4e5a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
9 changes: 9 additions & 0 deletions onlinejudge/implementation/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import onlinejudge
import onlinejudge.implementation.utils as utils
import onlinejudge.implementation.logging as log
import onlinejudge.implementation.version as version
from onlinejudge.implementation.command.download import download
from onlinejudge.implementation.command.login import login
from onlinejudge.implementation.command.submit import submit
Expand All @@ -13,12 +14,19 @@
from onlinejudge.implementation.command.test_reactive import test_reactive
from onlinejudge.implementation.command.code_statistics import code_statistics
from onlinejudge.implementation.command.get_standings import get_standings
import pipdate
import argparse
import sys
import os
import os.path
from typing import List, Optional


def version_check() -> None:
if pipdate.needs_checking(version.name):
print(pipdate.check(version.name, version.__version__), end='')


def get_parser() -> argparse.ArgumentParser:
parser = argparse.ArgumentParser(description='Tools for online judge services')
parser.add_argument('-v', '--verbose', action='store_true')
Expand Down Expand Up @@ -329,6 +337,7 @@ def run_program(args: argparse.Namespace, parser: argparse.ArgumentParser) -> No


def main(args: Optional[List[str]] = None) -> None:
version_check()
parser = get_parser()
namespace = parser.parse_args(args=args)
run_program(namespace, parser=parser)
1 change: 1 addition & 0 deletions onlinejudge/implementation/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Python Version: 3.x
name = 'online-judge-tools'
__author__ = 'Kimiyuki Onaka'
__email__ = '[email protected]'
__license__ = 'MIT License'
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def load_module(module_path):
readme = fh.read()

setup(
name='online-judge-tools',
name=version.name,
version=version.__version__,
description='Tools for online-judge services',
install_requires=[
Expand All @@ -23,6 +23,7 @@ def load_module(module_path):
'beautifulsoup4',
'colorama',
'sympy',
'pipdate',
],
long_description=readme,
author=version.__author__,
Expand Down

0 comments on commit 22b4e5a

Please sign in to comment.