build_version.py 20.8 KB
Newer Older
1 2 3 4
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
   NAME
LE GAC Renaud's avatar
LE GAC Renaud committed
5
          build_version -- set of tool to build release
6 7 8 9 10

    SYNOPSIS
          build_version [options]

    DESCRIPTION
LE GAC Renaud's avatar
LE GAC Renaud committed
11 12 13 14 15
          Helper script to build release and to push version number
          in CHANGELOG and VERSION files.

          It also performed the installation of the plugins, generated
          the documentation and minificated javascript libraries.
16 17 18 19 20 21

    EXAMPLES

            > build_version -h

    AUTHOR
22
          R. Le Gac, renaud.legac@cppm.in2p3.fr
23

24
    Copyright (c) 2012-2016 R. Le Gac
25 26

"""
27
import argparse
28 29 30 31 32 33 34
import datetime
import os
import re
import sys
import tempfile


35
from glob import glob
36
from os.path import join as opj
37
from subprocess import call, CalledProcessError, check_output
38

39

40
# constants
41
API = "api"
42
APP = os.path.basename(os.getcwd())
43 44 45
DOCSRC = "docs"
LATEX = "latex"
MSG_RELEASE = "Enter the new release: "
46 47
NOW = datetime.datetime.now()
PDF = "pdf"
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
REFERENCE = "reference"
USER = "user"
VERSION = "VERSION"

# path running on the localhost
APP_DIR = os.getcwd()
APP_STATIC = opj(APP_DIR, "static")
CHANGELOG = opj(APP_STATIC, "CHANGELOG")
DBUISRC = opj(APP_STATIC, "plugin_dbui", "src")
EXTJSSRC = opj(APP_STATIC, "plugin_extjs", "src")
JSDOC = opj(APP_STATIC, "docs", "jsduck")
JSLIBDEBUG = opj(APP_STATIC, "%s-debug.js" % APP)
JSLIBMIN = opj(APP_STATIC, "%s-min.js" % APP)
JSLIBSRC = opj(APP_STATIC, APP, "src")
PDFDOC = opj(APP_STATIC, "docs", PDF)

# path running behind a docker container
W2P_DIR_CNT = "/opt/web2py"
APP_DIR_CNT = opj(W2P_DIR_CNT, "applications", APP)
APP_STATIC_CNT =  opj(APP_DIR_CNT, "static")
68
DBUISRC_CNT = opj(APP_STATIC_CNT, "plugin_dbui", "src")
69 70
EXTJSSRC_CNT = opj(APP_STATIC_CNT, "plugin_extjs", "src")
JSDOC_CNT = opj(APP_STATIC_CNT, "docs", "jsduck")
71 72 73
JSLIBDEBUG_CNT = opj(APP_STATIC_CNT, "%s-debug.js" % APP)
JSLIBSRC_CNT = opj(APP_STATIC_CNT, APP, "src")
JSLIBMIN_CNT = opj(APP_STATIC_CNT, "%s-min.js" % APP)
74
JSLIBSRC_CNT = opj(APP_STATIC_CNT, APP, "src")
75 76 77 78 79 80 81 82 83


def build():
    """Compile the javascript code and build documentations.

    """
    compile_js()
    build_html()

84
    for doc in (USER,):
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
        docsrc = opj(DOCSRC, doc)

        if os.path.exists(docsrc):
            build_pdf(doc)


def build_html():
    """Build HTML documentations.
    The source files are located in the following directory::

        myapp/docs
        myapp/docs/api
        myapp/docs/reference
        myapp/docs/user

    """
    print "Build the HTML documentations..."

    jsduck()

    for doc in (API, REFERENCE, USER):
        docsrc = opj(DOCSRC, doc)

        if os.path.exists(docsrc):
            sphinx("-b html", docsrc, opj(DOCS, doc))


def build_pdf(doc):
    """ Build PDF documentations...

    Args:
        doc (str): sub-directory. Possible values are api, reference, user.

    """
    print "Build the PDF documentations..."

121 122 123 124 125
    if not which("pdflatex"):
        print '\n\tThe application pdflatex is missing !'
        print '\tSkip this step.\n'
        return

126 127 128 129 130 131 132 133 134 135
    latexdoc = opj(DOCS, LATEX)

    # generate the latex
    sphinx("-b latex", opj(DOCSRC, doc), latexdoc)

    # the current directory
    cwd = os.getcwd()

    # find the name of the tex file
    os.chdir(latexdoc)
136 137
    filenames = [el for el in os.listdir('.') if el.endswith('.tex')]
    filename = (filenames[0] if len(filenames) == 1 else None)
138

139
    if not filename:
140 141 142 143
        print "\n\tNo latex file !"
        return

    # process the latex file twice
144 145
    call(["pdflatex", filename])
    call(["pdflatex", filename])
146 147 148 149 150 151 152 153

    # move the pdf file
    os.chdir(cwd)

    pdfdir = opj(DOCS, PDF)
    if not os.path.exists(pdfdir):
        os.mkdir(pdfdir)

154 155
    fin = filename.replace('.tex', '.pdf')
    fout = "%s_%s.pdf" % (os.path.splitext(filename)[0], doc)
156 157 158 159 160 161 162 163 164
    os.rename(opj(latexdoc, fin), opj(pdfdir, fout))

    # remove the latex directory
    call(["rm", "-rf", latexdoc])

    print "PDF documentation in", PDFDOC


def change_log():
LE GAC Renaud's avatar
LE GAC Renaud committed
165
    """Commit CHANGELOG and VERSION files
166 167 168

    """
    print "Commit CHANGELOG..."
169
    if not which("git"):
170 171 172 173 174
        print '\n\tThe application git is missing !'
        print '\tSkip this step.\n'
        return

    # Commit modified files
LE GAC Renaud's avatar
LE GAC Renaud committed
175 176
    print 'git add', CHANGELOG, VERSION
    git("add", CHANGELOG, VERSION)
177 178

    print 'git commit'
179
    msg = "Start release %s" % get_version()
180 181 182 183 184
    git("commit -m", msg)


def compile_js():
    """compile_js the javascript code and generate the debug version
185
    as well as the minimised version.
186 187 188 189

    The compiler verify that the code complied with the class model
    and order the file in the proper way.

190
    The minimised library can be build in several ways, including
191 192 193 194 195 196 197 198 199 200 201
    the Ext JS class required by the applications. In the
    current version, the library contains only the dbui classes and
    the Ext JS ones have to be loaded separately. In that sense
    this command is very similar to the yuicompressor one.

    Several compressor can be used yui, closure compiler, ....
    In the current version, the default yui compressor is used?

    This operation relies on the Sencha Cmd:
    http://www.sencha.com/products/sencha-cmd/download

202
    The details documentation can be found:
203 204 205 206
    http://docs.sencha.com/extjs/4.2.2/#!/guide/command

    """
    print "Compile the javascript code ..."
207 208 209 210 211 212

    sencha = which("sencha")
    if len(sencha) == 0:
        print "\n\tThe application sencha is missing !"
        print "\tSee: http://www.sencha.com/products/sencha-cmd/download"
        print "\tSkip this step.\n"
213 214
        return

215
    if not os.path.exists(JSLIBSRC):
216
        print "\n\tNo javascript library. Exit.\n"
217 218
        return

219
    # clean previous version
220 221
    print "\n\tRemove old javascript library..\n"
    call(["rm", "-f", JSLIBDEBUG, JSLIBMIN])
222

223 224 225 226
    # NOTE
    # the processing depend on the localisation of sencha
    # either on the localhost or behind a docker container
    # the length of the cmd list allows to separate the two cases
227

228 229 230
    # NOTE
    # container is running as root
    # permissions have to be changed for the current user
231

232 233
    # localhost
    if len(sencha) == 1:
234

235 236 237 238 239 240
        cmd = list(sencha)
        cmd.extend([
            "-sdk", EXTJSSRC,
            "compile", "-classpath", "%s,%s" % (JSLIBSRC, DBUISRC),
            "exclude", "--namespace", "Ext,App",
            "and", "concat", JSLIBDEBUG])
241

242
        call(cmd)
243

244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292
        cmd = list(sencha)
        cmd.extend([
            "-sdk", EXTJSSRC,
            "compile", "-classpath", "%s,%s" % (JSLIBSRC, DBUISRC),
            "exclude", "--namespace", "Ext,App",
            "and", "concat", "--yui", JSLIBMIN])

        call(cmd)

    else:

        cmd = list(sencha)
        cmd.extend([
            "-sdk", EXTJSSRC_CNT,
            "compile", "-classpath", "%s,%s" % (JSLIBSRC_CNT, DBUISRC_CNT),
            "exclude", "--namespace", "Ext,App",
            "and", "concat", JSLIBDEBUG_CNT])

        call(cmd)

        cmd = list(sencha)
        cmd.extend([
            "-sdk", EXTJSSRC_CNT,
            "compile", "-classpath", "%s,%s" % (JSLIBSRC_CNT, DBUISRC_CNT),
            "exclude", "--namespace", "Ext,App",
            "and", "concat", "--yui", JSLIBMIN_CNT])

        call(cmd)

        cmd = ["docker", "exec", ARGS.docker_container,
               "chown", get_perm(), JSLIBDEBUG_CNT, JSLIBMIN_CNT]

        call(cmd)

    print '\n\tDebug version of the js library', JSLIBDEBUG, 'is ready'
    print '\tMinimised version of the js library', JSLIBMIN, 'is ready\n'


def get_perm():
    """"Return the permission of the current user.

    Returns:
        str: permission encoded as uid:gid

    """
    uid = check_output(["id", "-u"]).strip("\n")
    gid = check_output(["id", "-g"]).strip("\n")

    return "%s:%s" % (uid, gid)
293 294 295


def get_version():
296
    """Get the current version identifier in VERSION
LE GAC Renaud's avatar
LE GAC Renaud committed
297 298 299

    Returns:
        str: the version number
300 301

    """
302 303
    with open(VERSION, "rb") as fi:
        return fi.read()
304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320


def git(*args, **kwargs):
    """run any git instruction:

    Args:
        *args: list of variable arguments containing git command
            and their options

         **kwargs: keyword argument of the function ``subprocess.call``.

    Examples:
            git("add CHANGELOG foo.txt")
            git("add", CHANGELOG, "foo.txt")
            git("commit", stdout=fi)

    """
321
    if not which("git"):
322 323 324 325
        print '\n\tThe application git is missing !'
        print '\tSkip this step.\n'
        return

326
    cmd = ["git"]
327 328 329 330 331 332 333 334
    cmd.extend(args[0].split())

    if len(args) > 1:
        cmd.extend(args[1:])

    call(cmd, **kwargs)


335 336 337 338 339 340 341
def install_plugins(args):
    """Install or update plugins.

    Args:
        args (argparse.Namespace): command arguments

    """
342 343
    if args.plugins_tar:
        install_plugins_tar(args.plugins_tar, args.plugins)
344

345
    elif args.plugins_git:
346 347 348
        for plugin in args.plugins:
            install_plugin_git(args.plugins_git, plugin, args.plugins_release)

349 350 351 352
    else:
        print "Path to the plugins can be either a git repository",
        print "or a tar file. One of them has to be defined !"
        sys.exit(1)
353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453


def install_plugin_git(repository, plugin, release):
    """Install plugin from git repository

    Args:
        repository (str): path of the git repository.
        plugin (str): name of the plugin to be installed.
        release (str): release number for plugins.

    """
    print "\nInstall plugin", plugin

    # delete existing version
    for path in glob("./*/plugin_%s*" % plugin):
        print "Remove", path
        call(["rm", "-rf", path])

    # select the release
    app_dir = os.getcwd()
    os.chdir(repository)
    git_dir = os.getcwd()

    tag = ("master" if release == "latest" else release)
    git("checkout", tag)

    pattern = os.path.join(git_dir, "web2py.plugin.%s.*.w2p" % plugin)
    paths = glob(pattern)

    # select the compact version when possible
    if len(paths) == 0:
        print "No plugin", plugin
        sys.exit(1)

    elif len(paths) == 2:
        for el in paths:
            if el.endswith("min.w2p"):
                path = el
                break
    else:
        path = paths[0]

    # install
    print "tar", "-xf", path, "-C", app_dir
    call(["tar", "-xf", path, "-C", app_dir])

    # restore the git repository
    git("checkout", "master")
    os.chdir(app_dir)


def install_plugins_tar(path, plugins):
    """Install plugin from tar file

    Args:
        path (str): path of the tar file.
        plugins (list): list of plugin to be installed.

    """
    app_dir = os.getcwd()

    # untar in /tmp
    tar_dir = '/tmp/w2p_plugins'
    if not os.path.exists(tar_dir):
        os.mkdir(tar_dir)

    call(["tar", "-xf", path, "-C", tar_dir])

    # untar individual files
    for plugin in plugins:

        # delete existing version
        for path in glob("./*/plugin_%s*" % plugin):
            print "Remove", path
            call(["rm", "-rf", path])

        # get the plugin path
        pattern = os.path.join(tar_dir, "web2py.plugin.%s.*.w2p" % plugin)
        paths = glob(pattern)

        # select the compact version when possible
        if len(paths) == 0:
            print "No plugin", plugin
            sys.exit(1)

        elif len(paths) == 2:
            for el in paths:
                if el.endswith("min.w2p"):
                    path = el
                    break
        else:
            path = paths[0]

        # install
        print "tar", "-xf", path, "-C", app_dir
        call(["tar", "-xf", path, "-C", app_dir])

    # cleam
    call("cd /tmp && rm -rf w2p_plugins", shell=True)


454 455 456 457 458 459
def jsduck():
    """Generate the JavaScript documentation.
    The HTML files are located in static/plugin_dbui/docs/jsduck

    """
    print "Build the javascript documentation..."
460 461 462

    cmd = which("jsduck")
    if len(cmd) == 0:
463 464 465 466
        print '\n\tThe application jsduck is missing !'
        print '\tSkip this step.\n'
        return

467
    if not os.path.exists(JSLIBSRC):
468
        print '\n\tNo javascript library. Exit.'
469 470
        return

471
    # clean
472
    print "\n\tRemove old javascript documentation..."
473
    call(["rm", "-rf", JSDOC])
474

475 476
    # NOTE
    # the processing depend on the localisation of jsduck
477
    # either on the localhost or behind a docker container
478
    # the length of the cmd list allows to separate the two cases
479

480 481 482 483
    # NOTE
    # container is running as root
    # permissions have to be changed for the current user

484
    if len(cmd) == 1:
485

486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501
        cmd.extend([EXTJSSRC, JSLIBSRC,
                    "--output", JSDOC,
                    "--title", "plugin_dbui %s" % get_version(),
                    "--warnings=-all:" + EXTJSSRC])

        call(cmd)

    # docker container
    else:

        cmd.extend([EXTJSSRC_CNT, JSLIBSRC_CNT,
                    "--output", JSDOC_CNT,
                    "--title", "plugin_dbui %s" % get_version(),
                    "--warnings=-all:" + EXTJSSRC_CNT])

        call(cmd)
502

503
        cnt = ARGS.docker_container
504
        call(["docker", "exec", cnt, "chown", "-R", get_perm(), JSDOC_CNT])
505 506

    print "\n\tJavaScript documentation in", JSDOC
507 508 509


def set_version(version):
510
    """Set release identifier in CHANGELOG and VERSION.
511 512 513 514 515 516 517 518

    Args:
        version (str): release identifier

    """
    print "Update CHANGELOG with the release", version, "..."

    # check tag in git
LE GAC Renaud's avatar
LE GAC Renaud committed
519
    if version in check_output(["git", "tag"]):
520 521 522 523 524 525
        print "\n\tRelease %s already exit in git" % version
        sys.exit(1)

    # look for a pattern HEAD in the CHANGELOG
    # split the the string in 2 parts (pre HEAD, post HEAD)
    print 'Set release', version, 'in', CHANGELOG
LE GAC Renaud's avatar
LE GAC Renaud committed
526 527
    with open(CHANGELOG) as fi:
        txt = fi.read()
528 529 530

    match = re.match("(.+HEAD\n)(.*)", txt, re.DOTALL)

531
    if match is None:
532 533 534 535 536 537 538 539
        print '\n\tNo HEAD tag in the CHANGELOG!\n'
        rep = raw_input('\tDo you want to continue [n]?')
        if rep not in ('y', 'yes'):
            sys.exit(1)

    # update the version and edit the CHANGELOG
    tpl = (match.group(1), version, NOW.strftime('%b %Y'), match.group(2))
    txt = '%s\n%s (%s)\n%s' % tpl
LE GAC Renaud's avatar
LE GAC Renaud committed
540 541 542 543

    with open(CHANGELOG, 'w') as fi:
        fi.write(txt)

544 545 546
    call(["vim", CHANGELOG])

    # cleaning
547 548 549
    filename = "%s~" % CHANGELOG
    if os.path.exists(filename):
        os.remove(filename)
550

551
    # update VERSION
LE GAC Renaud's avatar
LE GAC Renaud committed
552
    with open(VERSION, 'w') as fichier:
553 554
        fichier.write(version)

555 556 557 558 559 560 561 562 563 564 565 566 567 568 569

def sphinx(*args, **kwargs):
    """run the sphinx-build:

    Args:
        *args: list of variable arguments containing the sphinx-build options.

         **kwargs: keyword argument of the function ``subprocess.call``.

    Examples:

            sphinx("-b html sourcedir outdir")
            sphinx("-b html", sourcedir, outdir)

    """
570
    if not which("sphinx-build"):
571 572 573 574
        print '\n\tThe application sphinx is missing !'
        print '\tSkip this step.\n'
        return

575
    cmd = ["sphinx-build"]
576 577 578 579 580 581 582 583 584 585 586 587 588 589
    cmd.extend(args[0].split())

    if len(args) > 1:
        cmd.extend(args[1:])

    call(cmd, **kwargs)


def start_release():
    """Start the release cycle.

    """
    print "Start the release cycle..."

590 591
    git("checkout", "master")

592 593 594 595 596 597 598 599 600 601 602 603
    old_release = get_version()
    print "Current release is", old_release

    new_release = raw_input(MSG_RELEASE)
    if not new_release:
        sys.exit(0)

    set_version(new_release)
    change_log()
    build()


604
def which(cmd):
605 606
    """Test if the command exists on the localhost or on a docker container.
    Return the sequence to execute it. Priority is given to the localhost.
607 608

    Args:
609
        cmd (str): name of the command
610 611

    Returns:
612 613
        list: command to be executed. The list is empty when the command is
            not found.
614 615

    """
616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638
    # local host
    try:
        out = check_output(["which", cmd])
        return [out.strip("\n")]

    except CalledProcessError:
        print "\n\tCommand", cmd, "not found on the localhost"

    # docker container is running ?
    container = ARGS.docker_container
    is_running = False

    for line in check_output(["docker", "ps"]).split("\n"):
        li = line.split()
        if li[-1] == container:
            is_running = True
            break

    if not is_running:
        print "\n\tDocker container", container, "is not running !"
        return []

    # docker container
639
    try:
640 641 642
        out = check_output(["docker", "exec", container, "which", cmd])
        path = out.strip("\n")
        return ["docker", "exec", container, path]
643

LE GAC Renaud's avatar
LE GAC Renaud committed
644
    except CalledProcessError:
645 646
        print "\n\tCommand", cmd, "not found on the %s container" % container
        return []
647 648


649 650 651
if __name__ == '__main__':

    # define script options
652
    APS = argparse.ArgumentParser()
653

654 655 656 657 658 659 660
    APS.add_argument("-a", "--api-doc",
                     action="store_true",
                     help="build the API documentation in HTML.")

    APS.add_argument("-A", "--api-pdf",
                     action="store_true",
                     help="build the API documentation in PDF.")
661

662 663
    APS.add_argument("-b", "--build",
                     action="store_true",
664
                     help="build the js library and the documentation.")
665

666 667 668
    APS.add_argument("-c", "--compile",
                     action="store_true",
                     help="compile the javascript library.")
669

670 671
    APS.add_argument("-C", "--commit-changelog",
                     action="store_true",
672 673 674
                     help="commit CHANGELOG. "
                          "To be used with --write-release. "
                          "Recommend to use --start-release.")
675

676 677 678 679 680 681
    APS.add_argument("-d", "--docker-container",
                     default="dev",
                     help="docker container housing jsduck, sencha and sphinx "
                          "commands [%(default)s]. The container has to ran.",
                     metavar = "<name>")

682 683 684
    APS.add_argument("-j", "--jsduck",
                     action="store_true",
                     help="build the JavaScript documentation.")
685

686 687 688
    APS.add_argument("-r", "--reference-doc",
                     action="store_true",
                     help="build the reference manual in HTML.")
689

690 691 692 693 694 695
    APS.add_argument("-R", "--reference-pdf",
                     action="store_true",
                     help="build the reference manual in PDF.")

    APS.add_argument("-s", "--start-release",
                     action="store_true",
696 697 698 699 700
                     help="start the new release cycle. "
                          "Set the release number in the changelog and "
                           "commit changes in the master branch. "
                           "Equivalent to --write-release followed by "
                           "--commit-changelog.")
701 702 703 704 705 706 707 708 709 710 711 712 713 714 715

    APS.add_argument("-u", "--user-doc",
                     action="store_true",
                     help="build the user manual in HTML.")

    APS.add_argument("-U", "--user-pdf",
                     action="store_true",
                     help="build the user manual in PDF.")

    APS.add_argument("-v", "--version",
                     action="store_true",
                     help="get the current release identifier.")

    APS.add_argument("-w", "--write-release",
                     action="store_true",
716
                     help="write the release number in CHANGELOG and VERSION. "
717 718
                          "To be used with --commit-changelog. "
                          "Recommend to use --start-release.")
719

720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741
    APS.add_argument("--plugins",
                     nargs="+",
                     help="plugins to be installed. To be used with "
                          "--plugin-release and  --plugin-git or --plugin-tar."
                          " Possible values are ace, dbui, extjs and mathjax.",
                     metavar="<plugin>")

    APS.add_argument("--plugins-release",
                     default="latest",
                     help="release number for plugin [%(default)s]. "
                          "To be used with --plugin-git.",
                     metavar="<release>")

    APS.add_argument("--plugins-git",
                     default="../plugin_dbui_build",
                     help="git repository containing plugins [%(default)s].",
                     metavar="<path>")

    APS.add_argument("--plugins-tar",
                     help="tar file containing the plugins",
                     metavar="<path>")

742 743 744 745 746 747 748 749
    ARGS = APS.parse_args()

    if ARGS.api_doc:
        sphinx("-b html", opj(DOCSRC, API), opj(DOCS, API))

    if ARGS.api_pdf:
        build_pdf(API)

750 751 752
    if ARGS.build:
        build()

753
    if ARGS.compile:
754 755
        compile_js()

756
    if ARGS.commit_changelog:
757 758
        change_log()

759
    if ARGS.jsduck:
760 761
        jsduck()

762 763 764
    if ARGS.plugins:
        install_plugins(ARGS)

765
    if ARGS.write_release:
766 767
        set_version(raw_input(MSG_RELEASE))

768
    if ARGS.reference_doc:
769 770
        sphinx("-b html", opj(DOCSRC, REFERENCE), opj(DOCS, REFERENCE))

771
    if ARGS.reference_pdf:
772 773
        build_pdf(REFERENCE)

774
    if ARGS.start_release:
775 776
        start_release()

777
    if ARGS.user_doc:
778 779
        sphinx("-b html", opj(DOCSRC, USER), opj(DOCS, USER))

780
    if ARGS.user_pdf:
781 782
        build_pdf(USER)

783
    if ARGS.version:
784 785
        print "\nThe current release is %s\n" % get_version()

LE GAC Renaud's avatar
LE GAC Renaud committed
786
    sys.exit(0)