Skip to content

Commit

Permalink
satex version
Browse files Browse the repository at this point in the history
  • Loading branch information
pauleve committed Mar 1, 2020
1 parent 8912c13 commit b35d6b9
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
17 changes: 16 additions & 1 deletion satex.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@
import subprocess
import sys
import tempfile
import textwrap
import time
from urllib.request import urlopen

__version__ = "0.93-dev"

DOCKER_NS = "satex"
REGISTRY_BASEURL = "https://raw.githubusercontent.com/sat-heritage/docker-images/master/"

Expand Down Expand Up @@ -390,6 +393,8 @@ def mrproper(args):
info(" ".join(argv))
sys.exit(subprocess.call(argv))

def print_version(args):
print(__version__)
#
##

Expand All @@ -403,7 +408,13 @@ def main(redirected=False):
from satex import main
return main(redirected=True)

parser = argparse.ArgumentParser(prog=sys.argv[0])
parser = argparse.ArgumentParser(prog=os.path.basename(sys.argv[0]),
description="Helper script for managing SAT Heritage Docker images",
formatter_class=argparse.RawDescriptionHelpFormatter,
epilog=textwrap.dedent(f"""\
GitHub: https://github.com/sat-heritage/docker-images
DockerHub: https://hub.docker.com/u/satex
Version: {__version__}"""))

parser.add_argument("--refresh-list", default=False, action="store_true",
help="Force refresh of the list of images")
Expand Down Expand Up @@ -478,6 +489,10 @@ def main(redirected=False):
parents=[spec_parser])
p.set_defaults(func=push_images)

subparsers.add_parser("version",
help="Print script version")\
.set_defaults(func=print_version)

args = parser.parse_args()
if not hasattr(args, "func"):
return parser.print_help()
Expand Down
16 changes: 14 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
# -*- coding: utf-8

import os
import re
from setuptools import setup

META = {}
META_FILE = os.path.join(NAME, "satex.py")
with open(META_FILE) as f:
__data = f.read()
for key in ["version"]:
match = re.search(r"^__{0}__ = ['\"]([^'\"]*)['\"]".format(key), __data, re.M)
if not match:
raise RuntimeError("Unable to find __{meta}__ string.".format(meta=key))
META[key] = match.group(1)

setup(name="satex",
version = "0.93",
author = "Loïc Paulevé",
author_email = "[email protected]",
url = "https://github.com/sat-heritage/docker-images",
Expand All @@ -14,5 +25,6 @@
"console_scripts": [
"satex= satex:main"
]
}
},
**META
)

0 comments on commit b35d6b9

Please sign in to comment.