def __init__(self):
        def argument_to_dic(list):
            dic = {}
            for z in list:
                dic[z[0]] = z[1]
            return dic

        list_argv = []
        argv.remove(argv[0])
        for elements in argv:
            variable_entrada = elements.split("=")
            if len(variable_entrada) == 1 or variable_entrada[1] == '':
                raise NameError(
                    '[ERROR] Invalid Arguments [python example.py var="text"]')
            list_argv.append(variable_entrada)
        self.dic_argv = argument_to_dic(list_argv)

        # Load Config
        if not path.exists('/.dockerenv'):
            try:
                #config.load_kube_config()
                config.load_kube_config(
                    config_file='/home/%s/.kube/config-slug' % (getlogin()))
            except OSError:
                config.load_kube_config(
                    config_file='/home/%s/.kube/config-slug' %
                    (pwd.getpwuid(getuid()).pw_name))
        # config.load_kube_config()
        # config.load_kube_config(config_file='%s/credentials/config' % (self.ruta_exec))
        else:
            config.load_incluster_config()

        # Define API
        self.v1 = client.CoreV1Api()
        self.extv1beta1 = client.ExtensionsV1beta1Api()
예제 #2
0
def main():
    if "--setuptools" in argv:
        argv.remove("--setuptools")
        from setuptools import setup
    else:
        from distutils.core import setup

    fusil = load_source("version", path.join("fusil", "version.py"))
    PACKAGES = {}
    for name in MODULES:
        PACKAGES[name] = name.replace(".", "/")

    install_options = {
        "name": fusil.PACKAGE,
        "version": fusil.VERSION,
        "url": fusil.WEBSITE,
        "download_url": fusil.WEBSITE,
        "author": "Victor Stinner",
        "description": "Fuzzing framework",
        "long_description": open('README').read(),
        "classifiers": CLASSIFIERS,
        "license": fusil.LICENSE,
        "packages": PACKAGES.keys(),
        "package_dir": PACKAGES,
        "scripts": ("scripts/fusil",),
    }
    setup(**install_options)
예제 #3
0
 def on_actionNewSession_triggered(self, checked=False):
     try:
         if len(argv) > 1:
             argv.remove(argv[1])
         pid = spawnvp(P_NOWAIT, argv[0], argv)
     except (NameError, ):
         Popen('"%s" "%s"' % (executable, argv[0], ))
예제 #4
0
 def test3(): 
     argv.append('1')
     argv.append('2')
     try: script = WC('nt')
     except StartKeyError: 
         argv.remove('1')
         argv.remove('2')
예제 #5
0
 def test4(): 
     argv.append('l')
     argv.append('w')
     try: script = WC('nt')  
     except InteriorSyntaxError:
         argv.remove('l')
         argv.remove('w')
예제 #6
0
def main():
    if "--setuptools" in argv:
        argv.remove("--setuptools")
        from setuptools import setup
        use_setuptools = True
    else:
        from distutils.core import setup
        use_setuptools = False

    fusil = load_source("version", path.join("fusil", "version.py"))
    PACKAGES = {}
    for name in MODULES:
        PACKAGES[name] = name.replace(".", "/")

    long_description = open('README').read() + open('ChangeLog').read()

    install_options = {
        "name": fusil.PACKAGE,
        "version": fusil.VERSION,
        "url": fusil.WEBSITE,
        "download_url": fusil.WEBSITE,
        "author": "Victor Stinner",
        "description": "Fuzzing framework",
        "long_description": long_description,
        "classifiers": CLASSIFIERS,
        "license": fusil.LICENSE,
        "packages": PACKAGES.keys(),
        "package_dir": PACKAGES,
        "scripts": SCRIPTS,
    }
    if use_setuptools:
        install_options["install_requires"] = ["python-ptrace>=0.6"]
    setup(**install_options)
예제 #7
0
def main():
    if "--setuptools" in argv:
        argv.remove("--setuptools")
        from setuptools import setup
        use_setuptools = True
    else:
        from distutils.core import setup
        use_setuptools = False

    ufwi_conf = load_source("version", path.join("ufwi_conf", "version.py"))

    long_description = open('README').read() + open('ChangeLog').read()

    install_options = {
        "name": ufwi_conf.PACKAGE,
        "version": ufwi_conf.VERSION,
        "url": ufwi_conf.WEBSITE,
        "download_url": ufwi_conf.WEBSITE,
        "license": ufwi_conf.LICENSE,
        "author": "Francois Toussenel, Michael Scherrer, Feth Arezki, Pierre-Louis Bonicoli",
        "description": "System configuration backend and frontend",
        "long_description": long_description,
        "classifiers": CLASSIFIERS,
        "packages": PACKAGES,
    }
    if use_setuptools:
        install_options["install_requires"] = ["IPy>=0.42"]
    setup(**install_options)
예제 #8
0
def main():
    if "--setuptools" in argv:
        argv.remove("--setuptools")
        from setuptools import setup
        use_setuptools = True
    else:
        from distutils.core import setup
        use_setuptools = False

    ufwi_ruleset = load_source("version", path.join("ufwi_ruleset", "version.py"))

    long_description = open('README').read() + open('ChangeLog').read()

    install_options = {
        "name": "ufwi_rulesetqt",
        "version": ufwi_ruleset.VERSION,
        "url": ufwi_ruleset.WEBSITE,
        "download_url": ufwi_ruleset.WEBSITE,
        "license": ufwi_ruleset.LICENSE,
        "author": "Victor Stinner",
        "description": "Netfilter configuration backend",
        "long_description": long_description,
        "classifiers": CLASSIFIERS,
        "packages": PACKAGES,
        "scripts": ("ufwi_ruleset_qt",),
    }
    if use_setuptools:
        install_options["install_requires"] = ["ufwi_ruleset>=3.0", "PyQt4>=4.4"]
    setup(**install_options)
예제 #9
0
파일: setup.py 프로젝트: maximerobin/Ufwi
def main():
    if "--setuptools" in argv:
        argv.remove("--setuptools")
        from setuptools import setup
        use_setuptools = True
    else:
        from distutils.core import setup
        use_setuptools = False

    long_description = "Edenwall multisite interface"

    install_options = {
        "name": "ew4-multisite-qt",
        "version": "1.0",
        "url": "http://inl.fr/",
        "download_url": "",
        "license": "License",
        "author": "Laurent Defert",
        "description": "Edenwall multisite interface",
        "long_description": long_description,
        "classifiers": CLASSIFIERS,
        "packages": PACKAGES,
        "scripts": ("ew4-multisite-qt",),
    }
    if use_setuptools:
        install_options["install_requires"] = ["nufaceqt>=3.0", "PyQt4>=4.4"]
    setup(**install_options)
예제 #10
0
파일: setup.py 프로젝트: cherry-wb/segvault
def main():
    from imp import load_source
    from os import path
    from sys import argv

    if "--setuptools" in argv:
        argv.remove("--setuptools")
        from setuptools import setup
    else:
        from distutils.core import setup

    ptrace = load_source("version", path.join("ptrace", "version.py"))
    PACKAGES = {}
    for name in MODULES:
        PACKAGES[name] = name.replace(".", "/")

    install_options = {
        "name": ptrace.PACKAGE,
        "version": ptrace.VERSION,
        "url": ptrace.WEBSITE,
        "download_url": ptrace.WEBSITE,
        "author": "Victor Stinner",
        "description": "python binding of ptrace",
        "long_description": LONG_DESCRIPTION,
        "classifiers": CLASSIFIERS,
        "license": ptrace.LICENSE,
        "packages": PACKAGES.keys(),
        "package_dir": PACKAGES,
        "scripts": SCRIPTS,
    }
    setup(**install_options)
예제 #11
0
def main():
    from imp import load_source
    from os import path
    from sys import argv

    if "--setuptools" in argv:
        argv.remove("--setuptools")
        from setuptools import setup
    else:
        from distutils.core import setup

    ptrace = load_source("version", path.join("ptrace", "version.py"))
    PACKAGES = {}
    for name in MODULES:
        PACKAGES[name] = name.replace(".", "/")

    install_options = {
        "name": ptrace.PACKAGE,
        "version": ptrace.VERSION,
        "url": ptrace.WEBSITE,
        "download_url": ptrace.WEBSITE,
        "author": "Victor Stinner",
        "description": "python binding of ptrace",
        "long_description": LONG_DESCRIPTION,
        "classifiers": CLASSIFIERS,
        "license": ptrace.LICENSE,
        "packages": PACKAGES.keys(),
        "package_dir": PACKAGES,
        "scripts": SCRIPTS,
    }
    setup(**install_options)
예제 #12
0
def main():
    if "--setuptools" in argv:
        argv.remove("--setuptools")
        from setuptools import setup
    else:
        from distutils.core import setup

    fusil = load_source("version", path.join("fusil", "version.py"))
    PACKAGES = {}
    for name in MODULES:
        PACKAGES[name] = name.replace(".", "/")

    install_options = {
        "name": fusil.PACKAGE,
        "version": fusil.VERSION,
        "url": fusil.WEBSITE,
        "download_url": fusil.WEBSITE,
        "author": "Victor Stinner",
        "description": "Fuzzing framework",
        "long_description": open('README').read(),
        "classifiers": CLASSIFIERS,
        "license": fusil.LICENSE,
        "packages": PACKAGES.keys(),
        "package_dir": PACKAGES,
        "scripts": ("scripts/fusil", ),
    }
    setup(**install_options)
예제 #13
0
def main():
    printSolutions = "-p" in argv
    bfsSearch = "-bfs" in argv
    if printSolutions:
        argv.remove("-p")
    if bfsSearch:
        argv.remove("-bfs")
    if len(argv) != 3:
        print "Usage:\t rushhour.py [-p] [-bfs] inputFile outputFile"
        print "\t -p \t print solution to stdout"
        print "\t -bfs \t do a depth-first search"
        exit()
    inPath = argv[1]
    outPath = argv[2]
            
    g = Grid(6, 6, 3)
    loadToGrid(inPath, g)
    g.printGrid()
    Solver = Search(g)
    Solver.useBFS(bfsSearch)
    moves = Solver.aStarSearch()
    if moves != []:
        print ("Solved in %i moves" % len(moves))
        if printSolutions:
            Solver.printSolution(moves)
        writeToFile(outPath, moves)
    else:
        print "No Solution Found"
예제 #14
0
def main():
    from imp import load_source
    from os import path
    from sys import argv

    if "--setuptools" in argv:
        argv.remove("--setuptools")
        from setuptools import setup, Extension
    else:
        from distutils.core import setup, Extension

    cptrace_ext = Extension('cptrace', sources=SOURCES)

    cptrace = load_source("version", path.join("cptrace", "version.py"))

    install_options = {
        "name": cptrace.PACKAGE,
        "version": cptrace.VERSION,
        "url": cptrace.WEBSITE,
        "download_url": cptrace.WEBSITE,
        "license": cptrace.LICENSE,
        "author": "Victor Stinner",
        "description": "python binding of ptrace written in C",
        "long_description": LONG_DESCRIPTION,
        "classifiers": CLASSIFIERS,
        "ext_modules": [cptrace_ext],
    }
    setup(**install_options)
예제 #15
0
def main():
    from imp import load_source
    from os import path
    from sys import argv

    if "--setuptools" in argv:
        argv.remove("--setuptools")
        from setuptools import setup, Extension
    else:
        from distutils.core import setup, Extension

    cptrace_ext = Extension('cptrace', sources=SOURCES)

    cptrace = load_source("version", path.join("cptrace", "version.py"))

    install_options = {
        "name": cptrace.PACKAGE,
        "version": cptrace.VERSION,
        "url": cptrace.WEBSITE,
        "download_url": cptrace.WEBSITE,
        "license": cptrace.LICENSE,
        "author": "Victor Stinner",
        "description": "python binding of ptrace written in C",
        "long_description": LONG_DESCRIPTION,
        "classifiers": CLASSIFIERS,
        "ext_modules": [cptrace_ext],
    }
    setup(**install_options)
예제 #16
0
def main():
    if len(argv) is 2:
        print(mostvibrant_allcolors(argv[1]))
    elif len(argv) is 3 and '-p' in argv:
        argv.remove('-p')
        print(mostvibrant_palette(argv[1]))
    else:
        usage()
예제 #17
0
파일: setup.py 프로젝트: simiolabs/flowbber
def find_packages(lib_directory):
    """
    Determine packaging options depending on the packaging mode and flags.

    Supports:

    - Source distribution.
    - Pure Python wheels.
    - Cythonized binary wheels.

    ::

        setup(
            ...
            **find_packages('lib')
        )

    :param str lib_directory: Path to the location of the packages.

    :return: A dictionary with options for the setup() call depending on
     calling parameters.
    :rtype: dict
    """
    from sys import argv
    from os.path import join

    if 'bdist_wheel' in argv and '--binary' in argv:

        argv.remove('--binary')

        from Cython.Build import cythonize

        packaging = {
            'ext_modules': cythonize(join(lib_directory, '**/*.py')),
        }

        print('Extension modules found:')
        for ext_module in packaging['ext_modules']:
            print('  {}'.format(ext_module.name))
        print('--')

    else:

        from setuptools import find_packages as find_source_packages

        packaging = {
            'package_dir': {
                '': lib_directory
            },
            'packages': find_source_packages(lib_directory),
        }

        print('Packages found (under {}):'.format(lib_directory))
        for package in sorted(packaging['packages']):
            print('  {}'.format(package))
        print('--')

    return packaging
예제 #18
0
    def test_g1_check_argv_with(self):
        """
        Test the check_if_cmdinp() function with argv
        """
        arg = "beehive"
        argv.append(arg)

        filename = cg.check_if_cmdinp()
        self.assertEqual(filename, arg)
        argv.remove(arg)
예제 #19
0
def popoption(ident, argv=None):
    if argv is None:
        from sys import argv
    if len(ident) == 1:
        ident = '-' + ident
    else:
        ident = '--' + ident
    found = ident in argv
    if found:
        argv.remove(ident)
    return found
예제 #20
0
    def __init__(self, input_dic_argv, input_debug):

        self.dic_argv = input_dic_argv
        self.backup_label = "backup"

        def argument_to_dic(list):
            dic = {}
            for z in list:
                dic[z[0]] = z[1]
            return dic

        list_argv = []
        argv.remove(argv[0])
        for elements in argv:
            var_input = elements.split("=")
            if len(var_input) == 1 or var_input[1] == '':
                raise NameError(
                    '[ERROR] Invalid Arguments [python example.py var="text"]')
            list_argv.append(var_input)
        self.dic_argv = argument_to_dic(list_argv)

        if self.dic_argv["mode"] == "methodical_modules":
            self.name_configmap = "databases-conf"
        else:
            self.name_configmap = "disks-conf"

        try:
            self.dic_argv["subtract_days"]
        except:
            self.dic_argv["subtract_days"] = "10"

        # Load Config
        if not path.exists('/.dockerenv'):
            config.load_kube_config(config_file='/home/%s/.kube/config' %
                                    (getpwuid(getuid()).pw_name))
        else:
            config.load_incluster_config()

        # Define API
        self.v1 = client.CoreV1Api()
        self.extv1beta1 = client.ExtensionsV1beta1Api()

        # Log
        logging.basicConfig(filename='%s/%s/kube-backup.log' % (\
          self.ruta_exec, \
          self.directory_backups \
        ), level=logging.INFO)
        self.chronos_logging = logging

        # Squirrel integration
        self.sqin = squirrel_integration(self)

        # Debug: debug disable send_mail
        self.debug = input_debug
예제 #21
0
파일: calmodels.py 프로젝트: pkgw/pwpy
def popoption(ident, argv=None):
    if argv is None:
        from sys import argv
    if len(ident) == 1:
        ident = "-" + ident
    else:
        ident = "--" + ident
    found = ident in argv
    if found:
        argv.remove(ident)
    return found
예제 #22
0
    def run(self):
        if len(self._funcs) >= 1:
            fun = self._funcs[0]
            lst = []
            dic = {}

            if len(self._funcs) > 1:
                gen = (x for x in self._funcs if x.__name__ == argv[1])
                fun = next(gen, fun)

            if len(argv) > 1 and fun.__name__ == argv[1]:
                argv.remove(fun.__name__)

            if len(argv) == 1 or argv[1] != 'help':
                for opt in argv[1:]:
                    if '=' in opt:
                        key, val = opt.split('=', 1)

                        dic[key] = val

                    else:
                        lst.append(opt)

                try:
                    return fun(*lst, **dic)

                except TypeError:
                    frm = trace()[-1]
                    mod = getmodule(frm[0])

                    if mod and mod.__name__ == __name__:
                        if fun.__doc__ is not None:
                            print(fun.__doc__, file=stderr)

                        else:
                            pass  # TODO: print a default synopsis.

                        return HALT

                    else:
                        raise

            else:
                if fun.__doc__ is not None:
                    print(fun.__doc__, file=stderr)

                else:
                    pass  # TODO: print a default synopsis.

                return HALT

        else:
            raise Exception()
예제 #23
0
def _argparse(pattern, argv, is_flag=True):
    if is_flag:
        found = pattern in argv
        if found:
            argv.remove(pattern)
        return found, argv
    else:
        arr = [arg for arg in argv if pattern in arg]
        if len(arr) == 0:  # not found
            return False, argv
        else:
            assert "=" in arr[0], f"{arr[0]} requires a value."
            argv.remove(arr[0])
            return arr[0].split("=")[1], argv
예제 #24
0
def parse_args():
    global _arguments
    if _arguments is None:
        _arguments = _parser.parse_args()
        app_args = ['--bs-name', '--bs-key', '--app-username', '--app-password', '--config', '--host']

        for name in _arguments.__dict__:
            if name != 'tests' and name != 'xunit_file':
                value = getattr(_arguments, name)
                if value in argv:
                    argv.remove(value)

        for name in app_args:
            if name in argv:
                argv.remove(name)
예제 #25
0
def checkArgs():
    """Check all the arguments to find options"""
    global noArgs, recur
    argv.remove(argv[0])  # Because is the name of the program
    for arg in argv:
        if arg == '--help' or arg == '--usage':
            print 'Usage: wma2ogg [directory | media.wma]'
            exit(0)
        if arg == '--version' or arg == '-V':
            print 'wma2ogg - ' + str(__version__)
            exit(0)
        if arg == '-R':
            recur = True
            argv.remove('-R')
    if len(argv) == 1:
        noArgs = True
예제 #26
0
def parse_argv() -> ("relative_paths", "rm_args"):
    """ Parse argv into something more usable
    :returns: a tuple of a list of relative_paths and args to pass into rm command
    """
    _ = argv.pop(0)
    rm_args = ""
    for item in argv:
        if item.startswith("-"):
            rm_args += item + " "
    for item in rm_args.split():
        argv.remove(item)
    if len(argv) < 1:
        raise (Exception("Too few arguments"))
    relative_paths = []
    for arg in argv:
        relative_paths.append(arg)
    return relative_paths, rm_args
예제 #27
0
    def mainMenu(self):
        # COMMAND LINE ARGUMENTS (ARGV[0] IS FILENAME).
        if len(argv) > 1:
            if "--quiet" in argv:
                argv.remove("--quiet")
                Write().get(" ".join(argv[1:]), quiet=True)     # p.w. only
            else:
                Write().get(" ".join(argv[1:]))                 # full info
        print("""
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 random p.a.s.s.w.o.r.d. manager
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[1] make
[2] enter yourself
[3] quick
~~~~~~~~~~~~~~~~~~
[4] get
[5] edit
[6] delete
~~~~~~~~~~~~~~~~~~
[7] print all
[8] change all
~~~~~~~~~~~~~~~~~~
[9] options
[0] quit
~~~~~~~~~~~~~~~~~~
""")
        menu = {
            "1": "Write().make()",                                  # ==> make.
            "2": "Write().make(rand=False)",              # ==> enter yourself.
            "3": "print(Write().quick())",                         # ==> quick.
            "4": "Write().get()",                                    # ==> get.
            "5": "Write().edit()",                                  # ==> edit.
            "6": "Write().delete()",                              # ==> delete.
            "7": "self.printAll()",               # ==> print all to text file.
            "8": "Write().changeAll()",                       # ==> change all.
            "9": "Options().optionsMenu()",                      # ==> options.
            "0": "self.quit()"                                      # ==> quit.
        }
        i = input()
        if i in menu:
            eval(menu[i])
            input("[enter] ...")              # pause before looping main menu.
        self.mainMenu()                    # loop main menu until [quit] given.
    def __init__(self):
        def argument_to_dic(list):
            dic = {}
            for z in list:
                dic[z[0]] = z[1]
            return dic

        list_argv = []
        argv.remove(argv[0])
        for elements in argv:
            variable_entrada = elements.split("=")
            if len(variable_entrada) == 1 or variable_entrada[1] == '':
                raise NameError(
                    '[ERROR] Invalid Arguments [python example.py var="text"]')
            list_argv.append(variable_entrada)
        self.dic_argv = argument_to_dic(list_argv)

        try:
            self.dic_argv["subtract_days"]
        except:
            self.dic_argv["subtract_days"] = "10"

        # Load Config
        if not path.exists('/.dockerenv'):
            config.load_kube_config(
                config_file='/home/%s/.kube/config_liberty_guadaltech' %
                (getpwuid(getuid()).pw_name))
            # config.load_kube_config()
            # config.load_kube_config(config_file='%s/credentials/config' % (self.ruta_exec))
        else:
            config.load_incluster_config()

        # Define API
        self.v1 = client.CoreV1Api()
        self.extv1beta1 = client.ExtensionsV1beta1Api()

        # Log
        logging.basicConfig(filename='%s/%s/kube-backup.log' %
                            (self.ruta_exec, self.directory_backups),
                            level=logging.INFO)

        # Squirrel integration
        self.sqin = squirrel_integration(self)
예제 #29
0
def popoption(ident, argv=None):
    ##<
    ## A lame routine for grabbing command-line arguments. Returns a
    ## boolean indicating whether the option was present. If it was, it's
    ## removed from the argument string. Because of the lame behavior,
    ## options can't be combined, and non-boolean options aren't
    ## supported. Operates on sys.argv by default.
    ##
    ## Note that this will proceed merrily if argv[0] matches your option.
    ##>
    if argv is None:
        from sys import argv
    if len(ident) == 1:
        ident = '-' + ident
    else:
        ident = '--' + ident
    found = ident in argv
    if found:
        argv.remove(ident)
    return found
예제 #30
0
파일: popoption.py 프로젝트: aimran/pwpy
def popoption (ident, argv=None):
##<
## A lame routine for grabbing command-line arguments. Returns a
## boolean indicating whether the option was present. If it was, it's
## removed from the argument string. Because of the lame behavior,
## options can't be combined, and non-boolean options aren't
## supported. Operates on sys.argv by default.
##
## Note that this will proceed merrily if argv[0] matches your option.
##>
    if argv is None:
        from sys import argv
    if len (ident) == 1:
        ident = '-' + ident
    else:
        ident = '--' + ident
    found = ident in argv
    if found:
        argv.remove (ident)
    return found
예제 #31
0
    def __init__(self):
        def argument_to_dic(list):
            dic = {}
            for z in list:
                dic[z[0]] = z[1]
            return dic

        def log_terminal(level, text):
            format_log = "[%s] %s"
            if level == 0:
                return format_log % ("DEBUG", text)
            elif level == 1:
                return format_log % ("INFO", text)
            elif level == 2:
                return format_log % ("ERROR", text)

        # Read arguments
        list_argv = []
        argv.remove(argv[0])
        for elements in argv:
            variable_entrada = elements.split("=")
            if len(variable_entrada) == 1 or variable_entrada[1] == '':
                raise NameError(
                    log_terminal(
                        2, 'Invalid Arguments [python example.py var="text"]'))
            list_argv.append(variable_entrada)
        self.dic_argv = argument_to_dic(list_argv)

        # Load Kubernetes Config
        if not path.exists('/.dockerenv'):
            # try:
            #     config.load_kube_config()
            # except OSError:
            #     config.load_kube_config(config_file='/home/%s/.kube/config-slug' % (pwd.getpwuid(getuid()).pw_name))
            pass
        else:
            config.load_incluster_config()

        # Define Kubernetes API
        self.v1 = client.CoreV1Api()
        self.extv1beta1 = client.ExtensionsV1beta1Api()
예제 #32
0
def _argparse(pattern, argv, is_flag=True, is_list=False):
    if is_flag:
        found = pattern in argv
        if found:
            argv.remove(pattern)
        return found, argv
    else:
        arr = [arg for arg in argv if pattern == arg.split("=")[0]]
        if is_list:
            if len(arr) == 0:  # not found
                return False, argv
            else:
                assert "=" in arr[0], f"{arr[0]} requires a value."
                argv.remove(arr[0])
                val = arr[0].split("=")[1]
                if "," in val:
                    return val.split(","), argv
                else:
                    return [val], argv
        else:
            if len(arr) == 0:  # not found
                return False, argv
            else:
                assert "=" in arr[0], f"{arr[0]} requires a value."
                argv.remove(arr[0])
                return arr[0].split("=")[1], argv
예제 #33
0
def parse_args():
    # parse custom arguments
    flags = {  # names flags that will be looked for
        'debug',  # indicates whether maps, debug messages should be printed
        'asserts',  # indicates whether asserts are included in generated C(++)
        'test'
    }

    # read flags from argv
    flags = {flag: '--' + flag in argv for flag in flags}
    # remove custom flags from argv so that setup doesn't get confused
    [argv.remove('--' + flag) for flag in flags if '--' + flag in argv]
    return flags
예제 #34
0
def main():
    from domainmodeller import settings
    
    # Parse command line arguments
    from sys import argv

    verbose = '-v' in argv
    if verbose: argv.remove('-v')

    log_level = logging.DEBUG if '-vv' in argv else logging.INFO
    if log_level==logging.DEBUG: argv.remove('-vv')
    
    if '-D' in argv:
        loc = argv.index('-D')
        del argv[loc]
        database = argv[loc]
        del argv[loc]
    else:
        database = settings.DATABASE

    from domainmodeller.storage import Storage
    storage = Storage.init_storage(database, **settings.BACKEND)
    run(storage, argv[1:], log_console=verbose, log_level=log_level)
예제 #35
0
    def test_f2_create_gamefield_file(self):
        """
        Test the create_gamefield() function with argv
        """
        config.NR_COLS = 10
        config.NR_ROWS = 10
        arg = "beehive"
        argv.append(arg)

        gamefield = cg.create_gamefield()
        self.assertEqual(gamefield, [
            [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [0, 0, 0, 0, 1, 1, 0, 0, 0, 0],
            [0, 0, 0, 1, 0, 0, 1, 0, 0, 0],
            [0, 0, 0, 0, 1, 1, 0, 0, 0, 0],
            [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        ])
        argv.remove(arg)
예제 #36
0
def main():
    if "--setuptools" in argv:
        argv.remove("--setuptools")
        from setuptools import setup
        use_setuptools = True
    else:
        from distutils.core import setup
        use_setuptools = False


    hachoir_parser = load_source("version", path.join("hachoir_parser", "version.py"))
    PACKAGES = {"hachoir_parser": "hachoir_parser"}
    for name in MODULES:
        PACKAGES["hachoir_parser." + name] = "hachoir_parser/" + name

    readme = open('README')
    long_description = readme.read()
    readme.close()

    install_options = {
        "name": hachoir_parser.PACKAGE,
        "version": hachoir_parser.__version__,
        "url": hachoir_parser.WEBSITE,
        "download_url": hachoir_parser.WEBSITE,
        "author": "Hachoir team (see AUTHORS file)",
        "description": "Package of Hachoir parsers used to open binary files",
        "long_description": long_description,
        "classifiers": CLASSIFIERS,
        "license": hachoir_parser.LICENSE,
        "packages": PACKAGES.keys(),
        "package_dir": PACKAGES,
    }
    if use_setuptools:
        install_options["install_requires"] = "hachoir-core>=1.3"
        install_options["zip_safe"] = True
    setup(**install_options)
예제 #37
0
import re
from sys import argv, stdout, stderr, exit
from math import *

# import ROOT with a fix to get batch mode (http://root.cern.ch/phpBB3/viewtopic.php?t=3198)
argv.append( '-b-' )
import ROOT
ROOT.gROOT.SetBatch(True)
argv.remove( '-b-' )

if len(argv) == 0: raise RuntimeError, "Usage: mlfitNormsToText.py [ -u ] mlfit.root";

errors = False
if len(argv) > 2 and argv[1] == "-u": 
    errors = True
    argv[1] = argv[2];
file = ROOT.TFile.Open(argv[1]);
prefit = file.Get("norm_prefit")
fit_s = file.Get("norm_fit_s")
fit_b = file.Get("norm_fit_b")
#if prefit == None: raise RuntimeError, "Missing fit_s in %s. Did you run MaxLikelihoodFit with --saveNorm?" % file;
if fit_s  == None: raise RuntimeError, "Missing fit_s in %s. Did you run MaxLikelihoodFit with --saveNorm?" % file;
if fit_b  == None: raise RuntimeError, "Missing fit_b in %s. Did you run MaxLikelihoodFit with --saveNorm?" % file;

iter = fit_s.createIterator()
norms={}
while True:
    norm_s = iter.Next()
    if norm_s == None: break;
    norm_b = fit_b.find(norm_s.GetName())
    norm_p = prefit.find(norm_s.GetName()) if prefit else None
예제 #38
0
from sys import platform, argv

from Cython.Distutils import build_ext, Extension
from Cython.Build import cythonize

include_dirs = ["../soplex/src"]  # soplex.h
library_dirs = ["./"]  # where libsoplex.a is located
sources = ["soplex.pyx"]
extra_compile_args = ["-std=c++0x", '-DWITH_LONG_DOUBLE', "-DSOPLEX_WITH_GMP"]
extra_link_args = []

# handle nersc-specific compiling options. This will have to be run with
# a UCS2 version of Python (the default in Ubuntu is UCS4, so a custom
# Python may have to be used.
if "--NERSC" in argv:
    argv.remove("--NERSC")
    extra_link_args = ["-Wl,--wrap=memcpy", "-Wl,-Bsymbolic-functions"]
    sources.append("memcpy.c")  # this prevents a GLIBC2.14 function

if platform == "darwin":
    # paths for homebrew gmp and gmpxx
    include_dirs.append("/usr/local/include")
    library_dirs.append("/usr/local/lib")
elif platform == "win32":
    extra_compile_args = ["-DSOPLEX_WITH_GMP", "/MT", "/EHsc"]

ext_modules = cythonize([Extension(
    "soplex", sources,
    include_dirs=include_dirs,
    libraries=["soplex", "gmp"],
    library_dirs=library_dirs,
예제 #39
0
for path in glob('%s/deps.d/*' % projectdir):       #DO_NOT_DISTRIBUTE
    systemPath.insert(0, path)                      #DO_NOT_DISTRIBUTE
for path in glob('%s/deps.d/*/client' % projectdir):#DO_NOT_DISTRIBUTE
    systemPath.insert(0, path)                      #DO_NOT_DISTRIBUTE

from sys import argv

from seecr.test.testrunner import TestRunner

from integration.sesameintegrationstate import SesameIntegrationState


if __name__ == '__main__':
    flags = ['--fast']
    fastMode = '--fast' in argv
    for flag in flags:
        if flag in argv:
            argv.remove(flag)

    runner = TestRunner()
    SesameIntegrationState(
        'default',
        tests=[
            'integration.sesametest.SesameTest'
        ],
        fastMode=fastMode).addToTestRunner(runner)

    testnames = argv[1:]
    runner.run(testnames)

예제 #40
0
import subprocess as sp
from sys import argv
from os import geteuid

dhcp_line = "iface eth0 inet dhcp"

# TODO: There must be a better way to get this info
ifconfig_re = """eth0[ ]+Link encap:Ethernet  HWaddr ..:..:..:..:..:..[ ]*
[ ]*inet addr:([0-9.]+)  Bcast:([0-9.]+)  Mask:([0-9.]+)"""

netstat_re = """^([0-9.]+)[ ]+([0-9.]+)"""

dry_run = False
if "-d" in argv:
    dry_run = True
    argv.remove("-d")

if not dry_run and geteuid() != 0:
    print("I need to be run with root permissions!.")
    exit(0)

filename = "/etc/network/interfaces"

f = open(filename, "r")
interfaces = f.read()
f.close()


def die(msg, code=1):
    print(msg)
    print("No changes where made.")
예제 #41
0
#!/usr/bin/env python

from numpy import *
import os
from sys import argv,exit
import forcebalance
from forcebalance.PT import PeriodicTable
from forcebalance.nifty import isint, printcool
import getopt

opts,args = getopt.getopt(argv[1:],'h')

AutoH = False
for o,a in opts:
    argv.remove(o)
    if o == "-h":
        AutoH = True

Alphabet = list(map(chr, range(65, 91)))

printcool(" Welcome to Lee-Ping's Force Field Generator --- ")
print " This script attempts to generate an OPLS force field "
print " from any Gaussian input file.  Here's how it works.  "
print " 1.  Define your atom types.                          "
print " 2.  Define corresponding OPLS atom types.            "
print "     If there is no corresponding OPLS type, then you "
print "     must define your own."
print " 3.  Select or input bonding parameters.              "
print "     If you selected OPLS atom types, then the program"
print "     will attempt to recommend parameters for you.    "
print " 4.  Finished: GRO and ITP files will be generated.   "
예제 #42
0
파일: setup.py 프로젝트: janschulz/igraph
def detect_igraph_library_dirs(default=LIBIGRAPH_FALLBACK_LIBRARY_DIRS):
    """Tries to detect the igraph library directory"""
    line, exit_code = get_output("pkg-config igraph --libs")
    if exit_code > 0 or len(line) == 0:
        return default
    opts = line.split()
    return [opt[2:] for opt in opts if opt[0:2] == "-L"]


sources = glob.glob(os.path.join("src", "*.c"))
include_dirs = []
library_dirs = []
libraries = []

if "--no-pkg-config" in argv:
    argv.remove("--no-pkg-config")
    libraries.append("igraph")
else:
    line, exit_code = get_output("pkg-config igraph")
    if exit_code > 0:
        print("Using default include and library paths for compilation")
        print("If the compilation fails, please edit the LIBIGRAPH_FALLBACK_*")
        print("variables in setup.py or include_dirs and library_dirs in ")
        print("setup.cfg to point to the correct directories and libraries")
        print("where the C core of igraph is installed")
        print("")

    include_dirs.extend(detect_igraph_include_dirs())
    library_dirs.extend(detect_igraph_library_dirs())
    libraries.extend(detect_igraph_libraries())
예제 #43
0
파일: setup.py 프로젝트: crudbug/canopsis
def setup(add_etc=True, **kwargs):
    """
    Setup dedicated to canolibs projects.

    :param add_etc: add automatically etc files (default True)
    :type add_etc: bool

    :param kwargs: enrich setuptools.setup method
    """

    # get setup path which corresponds to first python argument
    filename = argv[0]

    _path = dirname(abspath(expanduser(filename)))
    name = basename(_path)

    # add path to python path
    path.append(_path)

    # extend canopsis path with new sub modules and packages
    # canopsis.__path__ = extend_path(canopsis.__path__, canopsis.__name__)

    # get package
    package = lookup("canopsis.{0}".format(name))

    # set default parameters if not setted
    kwargs.setdefault('name', package.__name__)
    kwargs.setdefault('author', AUTHOR)
    kwargs.setdefault('author_email', AUTHOR_EMAIL)
    kwargs.setdefault('license', LICENSE)
    kwargs.setdefault('zip_safe', ZIP_SAFE)
    kwargs.setdefault('url', URL)
    kwargs.setdefault('package_dir', {'': _path})

    kwargs.setdefault('keywords', kwargs.get('keywords', '') + KEYWORDS)

    # set version
    version = getattr(package, '__version__', DEFAULT_VERSION)
    if version is not None:
        kwargs.setdefault('version', version)

    if '--no-conf' not in argv:
        # add etc content if exist and if --no-conf
        if add_etc:
            etc_path = join(_path, 'etc')

            if exists(etc_path):
                data_files = kwargs.get('data_files', [])
                target = getenv('CPS_PREFIX', join(sys_prefix, 'etc'))

                for root, dirs, files in walk(etc_path):
                    files_to_copy = [join(root, _file) for _file in files]
                    final_target = join(target, root[len(etc_path) + 1:])
                    data_files.append((final_target, files_to_copy))
                kwargs['data_files'] = data_files

    else:
        argv.remove('--no-conf')

    # add scripts if exist
    if 'scripts' not in kwargs:
        scripts_path = join(_path, 'scripts')
        if exists(scripts_path):
            scripts = []
            for root, dirs, files in walk(scripts_path):
                for _file in files:
                    scripts.append(join(root, _file))
            kwargs['scripts'] = scripts

    # add packages
    if 'packages' not in kwargs:
        packages = find_packages(where=_path, exclude=TEST_FOLDERS)
        kwargs['packages'] = packages

    # add description
    if 'long_description' not in kwargs:
        readme_path = join(_path, 'README')
        if exists(readme_path):
            with open(join(_path, 'README')) as f:
                kwargs['long_description'] = f.read()

    # add test
    if 'test_suite' not in kwargs:
        test_folders = \
            [folder for folder in TEST_FOLDERS if exists(join(_path, folder))]
        if test_folders:
            for test_folder in test_folders:
                kwargs['test_suite'] = test_folder
                break

    _setup(**kwargs)
예제 #44
0
파일: run_tests.py 프로젝트: daedadu/rdflib
    Requires Nose. Try:

        $ sudo easy_install nose

    Exiting. """,
            file=stderr,
        )
        exit(1)

    if "--with-coverage" in argv:
        try:
            import coverage
        except ImportError:
            print("No coverage module found, skipping code coverage.",
                  file=stderr)
            argv.remove("--with-coverage")
        else:
            NOSE_ARGS += COVERAGE_EXTRA_ARGS

    if True not in [
            a.startswith("-a") or a.startswith("--attr=") for a in argv
    ]:
        argv.append("--attr=" + ",".join(DEFAULT_ATTRS))

    if not [a for a in argv[1:] if not a.startswith("-")]:
        argv += DEFAULT_DIRS  # since nose doesn't look here by default..

    if not [a for a in argv if a.startswith("--where=")]:
        argv += [DEFAULT_LOCATION]

    finalArgs = argv + NOSE_ARGS
예제 #45
0
파일: setup.py 프로젝트: Woerd88/hachoir
#!/usr/bin/env python
from imp import load_source
from os import path
from sys import argv
if "--setuptools" in argv:
    argv.remove("--setuptools")
    from setuptools import setup
    use_setuptools = True
else:
    from distutils.core import setup
    use_setuptools = False

CLASSIFIERS = [
    'Intended Audience :: Developers',
    'Development Status :: 4 - Beta',
    'Environment :: X11 Applications',
    'Environment :: Win32 (MS Windows)',
    'Environment :: MacOS X',
    'Topic :: Software Development :: Disassemblers',
    'Topic :: Utilities',
    'License :: OSI Approved :: GNU General Public License (GPL)',
    'Operating System :: OS Independent',
    'Natural Language :: English',
    'Programming Language :: Python']

MODULES = ("field_view", "frame_view", "hex_view", "resource")

def main():
    hachoir_wx = load_source("version", path.join("hachoir_wx", "version.py"))

    long_description = open('README').read()
예제 #46
0
파일: utils.py 프로젝트: hforge/itools
def setup(path, ext_modules=None):
    ext_modules = ext_modules or []
    config = get_config()
    package_root = config.get_value('package_root')
    # Guess environment
    if "--development" in argv:
        environment = 'development'
        argv.remove("--development")
    else:
        environment = 'production'
    # Build
    if any(x in argv for x in ('build', 'install', 'sdist', 'egg_info')):
        version = build(path, config, environment)
    else:
        version = get_package_version(package_root)

    # Initialize variables
    package_name = config.get_value('package_name')
    if package_name is None:
        package_name = config.get_value('name')
    packages = [package_name]
    package_data = {package_name: []}

    # The sub-packages
    if config.has_value('packages'):
        subpackages = config.get_value('packages')
        for subpackage_name in subpackages:
            packages.append('%s.%s' % (package_name, subpackage_name))
    else:
        subpackages = []

    # Python files are included by default
    filenames = [ x.strip() for x in open(path + 'MANIFEST').readlines() ]
    filenames = [ x for x in filenames if not x.endswith('.py') ]

    # The data files
    prefix = '' if package_root == '.' else package_root + '/'
    prefix_n = len(prefix)
    for line in filenames:
        if not line.startswith(prefix):
            continue
        line = line[prefix_n:]

        path = line.split('/')
        if path[0] in subpackages:
            subpackage = '%s.%s' % (package_name, path[0])
            files = package_data.setdefault(subpackage, [])
            files.append(join_path(*path[1:]))
        elif path[0] not in ('archive', 'docs', 'scripts', 'test'):
            package_data[package_name].append(line)

    # The scripts
    if config.has_value('scripts'):
        scripts = config.get_value('scripts')
        scripts = [ join_path(*['scripts', x]) for x in scripts ]
    else:
        scripts = []

    # Long description
    if exists('README.rst'):
        with codecs.open('README.rst', 'r', 'utf-8') as readme:
            long_description = readme.read()
    else:
        long_description = config.get_value('description')

    author_name = config.get_value('author_name')
    # Requires
    install_requires = []
    if exists('requirements.txt'):
        install_requires = parse_requirements(
            'requirements.txt', session=PipSession())
        install_requires = [str(ir.req) for ir in install_requires]
    # XXX Workaround buggy distutils ("sdist" don't likes unicode strings,
    # and "register" don't likes normal strings).
    if 'register' in argv:
        author_name = unicode(author_name, 'utf-8')
    classifiers = [ x for x in config.get_value('classifiers') if x ]
    core.setup(name = package_name,
               version = version,
               # Metadata
               author = author_name,
               author_email = config.get_value('author_email'),
               license = config.get_value('license'),
               url = config.get_value('url'),
               description = config.get_value('title'),
               long_description = long_description,
               classifiers = classifiers,
               # Packages
               package_dir = {package_name: package_root},
               packages = packages,
               package_data = package_data,
               # Requires / Provides
               install_requires=install_requires,
               # Scripts
               scripts = scripts,
               cmdclass = {'build_ext': OptionalBuildExt},
               # C extensions
               ext_modules=ext_modules)
예제 #47
0
        else:
            return True # ignored

    sm_mta_sm_mta = sendmail_sendmail

def sigtermHandler(signum, frame):
    log(E_ALWAYS, 'SiGTERM received')

if __name__ == '__main__':
    global logfd
    from sys import argv, exit as sys_exit
    from signal import signal, SIGTERM

    if '-l' in argv:
        skiplist = []
        argv.remove('-l')
    else:
        skiplist = defskiplist

    if '-d' in argv:
        daemonize = True
        logfd = open('/var/log/pylog.log', 'a')
        argv.remove('-d')
    else:
        logfd = stdout
        daemonize = False

    if '-ng' in argv:
        logfd = open('/var/log/pylog.log', 'a')
        argv.remove('-ng')
#!/usr/bin/env python
import re
from sys import argv, stdout, stderr, exit, modules
from optparse import OptionParser

# import ROOT with a fix to get batch mode (http://root.cern.ch/phpBB3/viewtopic.php?t=3198)
argv.append("-b-")
import ROOT

ROOT.gROOT.SetBatch(True)
argv.remove("-b-")

from HiggsAnalysis.CombinedLimit.DatacardParser import *
from HiggsAnalysis.CombinedLimit.ModelTools import *
from HiggsAnalysis.CombinedLimit.ShapeTools import *
from HiggsAnalysis.CombinedLimit.PhysicsModel import *

parser = OptionParser(usage="usage: %prog [options] datacard.txt -o output \nrun with --help to get list of options")
addDatacardParserOptions(parser)
parser.add_option(
    "-P",
    "--physics-model",
    dest="physModel",
    default="HiggsAnalysis.CombinedLimit.PhysicsModel:defaultModel",
    type="string",
    help="Physics model to use. It should be in the form (module name):(object name)",
)
parser.add_option(
    "--PO",
    "--physics-option",
    dest="physOpt",
예제 #49
0
from distutils.core import setup
from sys import argv

import glob
from os.path import basename

extensions = []
if not '--no-extensions' in argv:
    for ext in glob.glob('pyglbuffers_extensions/*.py'):
        if 'create_mmo' in ext or '__init__' in ext:
            continue

        name = basename(ext).split('.')[0]
        extensions.append('pyglbuffers_extensions.'+name)        

else:
    argv.remove('--no-extensions')
   

setup(name='pyglbuffers',
      version='1.2.0',
      description='OpenGL buffers wrapper for python',
      author='Gabriel Dubé',
      author_email='*****@*****.**',
      license='MIT',
      url='https://github.com/gabdube/pyglbuffers',
      download_url='https://github.com/gabdube/pyglbuffers',
      py_modules=['pyglbuffers']+extensions,
     )
예제 #50
0
        import nose
    except ImportError:
        print >> stderr, """\
    Requires Nose. Try:

        $ sudo easy_install nose

    Exiting. """
        exit(1)

    if '--with-coverage' in argv + NOSE_ARGS:
        try:
            import coverage
        except ImportError:
            print >> stderr, "No coverage module found, skipping code coverage."
            argv.remove('--with-coverage')
        else:
            NOSE_ARGS += COVERAGE_EXTRA_ARGS

    if True not in [
            a.startswith('-a') or a.startswith('--attr=') for a in argv
    ]:
        argv.append('--attr=' + ','.join(DEFAULT_ATTRS))

    if not [a for a in argv[1:] if not a.startswith('-')]:
        argv += DEFAULT_DIRS  # since nose doesn't look here by default..

    finalArgs = NOSE_ARGS + argv
    print "Running nose with:", " ".join(finalArgs[1:])
    nose.run_exit(argv=finalArgs)
예제 #51
0
if len(argv) < 2:
    print "USAGE: " + executable + " " + argv[
        0] + " [setup command (install, develop...)]"
    exit(0)

from p2ner.core.components import _entry_points

cd = os.path.dirname(os.path.realpath(__file__))

COMPONENTS_DIR = os.path.join(cd, "p2ner", "components")
HOME_DIR = os.path.join(os.path.expanduser("~"), 'bin')

scripts = False
c = executable + ' setup.py'
if 'scripts' in argv:
    argv.remove('scripts')
    if '-s' not in argv:
        scripts = True

for s in argv[1:]:
    c = c + " " + s
c = 'cd ' + cd + ' && ' + c
os.system(c)
for ct in _entry_points:
    d = os.path.join(COMPONENTS_DIR, ct)
    directories = [
        os.path.join(d, dirname) for dirname in os.listdir(d)
        if os.path.isdir(os.path.join(d, dirname)) and dirname[0] != "."
    ]
    print directories
    for p in directories:
예제 #52
0
    QuaternionsPath = '../Quaternions'
else:
    raise EnvironmentError("Can't find `Quaternions` module.  Did you forget to `git submodule init` and `git submodule update`?")

## Build Quaternions first
print("\nInstalling Quaternions")
cmd = ' '.join(['cd {0} && {1}'.format(QuaternionsPath, executable),]+argv)
print(cmd)
check_call(cmd, shell=True)
print("Finished installing Quaternions\n")

## Check for `--no-GSL` option
if '--no-GSL' in argv:
    GSL=False
    GSLDef = ''
    argv.remove('--no-GSL')
else:
    GSL=True
    GSLDef = '-DUSE_GSL'

## If PRD won't let me keep a subdirectory, make one
from os.path import exists
from os import makedirs
if not exists('SphericalFunctions') :
    makedirs('SphericalFunctions')

## distutils doesn't build swig modules in the correct order by
## default -- the python module is installed first.  This will pop
## 'build_ext' to the beginning of the command list.
from distutils.command.build import build
build.sub_commands = sorted(build.sub_commands, key=lambda sub_command: int(sub_command[0]!='build_ext'))
예제 #53
0
#!/usr/bin/env python

from sys import argv
from compile import compile
from table2csv import convert

if __name__ == "__main__":
    if len(argv) > 1:
        if argv[1] == 'compile':
            compile(argv[2:])
        elif len(argv) > 2:
            if argv[1] == 'fetch':
                argv.remove('fetch')
            fetch = __import__('_sites.' + argv[1], globals(), locals(),
                               ['fetch'])
            for url in argv[2:]:
                title, tables = fetch.fetch(url)
                i = 1
                for table in tables:
                    convert(table, title + '-' + str(i), argv[1])
                    i += 1

def cleanName(name):
    return sub(
        'CR', '',
        sub(
            '_bin', '',
            sub('monotop_', '',
                sub('stat_error', 'stat', sub('Model', '_', name)))))


hasHelp = False
for X in ("-h", "-?", "--help"):
    if X in argv:
        hasHelp = True
        argv.remove(X)
argv.append('-b-')
import ROOT
ROOT.gROOT.SetBatch(True)
ROOT.gSystem.Load("libHiggsAnalysisCombinedLimit")
argv.remove('-b-')
if hasHelp: argv.append("-h")

parser = OptionParser(
    usage=
    "usage: %prog [options] in.root  \nrun with --help to get list of options")
parser.add_option(
    "--vtol",
    "--val-tolerance",
    dest="vtol",
    default=0.30,
예제 #55
0
    from sys import argv, exit, stderr
    try: import nose
    except ImportError:
        print >>stderr, """\
    Requires Nose. Try:

        $ sudo easy_install nose

    Exiting. """; exit(1)


    if '--with-coverage' in argv + NOSE_ARGS:
        try: import coverage
        except ImportError:
            print >>stderr, "No coverage module found, skipping code coverage."
            argv.remove('--with-coverage')
        else:
            NOSE_ARGS += COVERAGE_EXTRA_ARGS


    if True not in [a.startswith('-a') or a.startswith('--attr=') for a in argv]:
        argv.append('--attr=' + ','.join(DEFAULT_ATTRS))

    if not [a for a in argv[1:] if not a.startswith('-')]:
        argv += DEFAULT_DIRS # since nose doesn't look here by default..


    finalArgs = NOSE_ARGS + argv
    print "Running nose with:", " ".join(finalArgs[1:])
    nose.run_exit(argv=finalArgs)
예제 #56
0
    stderr.write('[same votes done]\n')


if __name__ == '__main__':
    if len(argv) not in (4, 5):
        print('''[Error] wrong parameters
run
 python voteparser.py <output prefix> <from-date> <end-date>
or
 python voteparser.py <output prefix> <from-date> <end-date> <reference list file>

use --count to get only the vote counts''')
        exit(1)

    count = False
    if '--count' in argv:
        argv.remove('--count')
        count = True
    prefix = argv[1]
    from_date = parser.parse(argv[2])
    to_date = parser.parse(argv[3])
    prefix += '_{0}_-_{1}'.format(argv[2].replace('/', '-'), argv[3].replace('/', '-'))
    print(prefix)
    if len(argv) == 5:
        ep_refs = set(map(str.strip, open(argv[4]).readlines()))
    else:
        ep_refs = None

    parse(prefix, from_date, to_date, ep_refs, only_count=count)
예제 #57
0
파일: run_tests.py 프로젝트: alcides/rdflib
    try:
        import nose
    except ImportError:
        print >> stderr, """\
    Requires Nose. Try:

        $ sudo easy_install nose

    Exiting. """
        exit(1)

    if "--with-coverage" in argv:
        try:
            import coverage
        except ImportError:
            print >> stderr, "No coverage module found, skipping code coverage."
            argv.remove("--with-coverage")
        else:
            NOSE_ARGS += COVERAGE_EXTRA_ARGS

    if True not in [a.startswith("-a") or a.startswith("--attr=") for a in argv]:
        argv.append("--attr=" + ",".join(DEFAULT_ATTRS))

    if not [a for a in argv[1:] if not a.startswith("-")]:
        argv += DEFAULT_DIRS  # since nose doesn't look here by default..

    finalArgs = argv + NOSE_ARGS
    print "Running nose with:", " ".join(finalArgs[1:])
    nose.run_exit(argv=finalArgs)