Beispiel #1
0
def pyi_makespec(pyi_args):  # pragma: no cover

    def run_makespec(opts, args):
        # Split pathex by using the path separator
        temppaths = opts.pathex[:]
        opts.pathex = []
        for p in temppaths:
            opts.pathex.extend(p.split(os.pathsep))

        spec_file = _pyi_makespec.main(args, **opts.__dict__)
        log.info('wrote %s' % spec_file)

    parser = optparse.OptionParser(
                                   usage=('%prog [opts] <scriptname> '
                                          '[ <scriptname> ...] | <specfile>'))

    _pyi_makespec.__add_options(parser)
    _pyi_build.__add_options(parser)
    _pyi_log.__add_options(parser)
    _pyi_compat.__add_obsolete_options(parser)

    opts, args = parser.parse_args(pyi_args)
    _pyi_log.__process_options(parser, opts)

    run_makespec(opts, args)
Beispiel #2
0
def pyi_makespec(pyi_args):  # pragma: no cover
    """Wrapper to configure make_spec for multipule pyinstaller versions"""
    def run_makespec(args, opts=None):
        """Setup args & run make_spec command"""
        if is_pyi30:
            # Split pathex by using the path separator
            temppaths = opts.pathex[:]
            opts.pathex = []
            for p in temppaths:
                opts.pathex.extend(p.split(os.pathsep))
            spec_file = _pyi_makespec.main(args, **opts.__dict__)
        else:
            # Split pathex by using the path separator
            temppaths = args.pathex[:]
            args.pathex = []
            for p in temppaths:
                args.pathex.extend(p.split(os.pathsep))

            spec_file = _pyi_makespec.main(args.scriptname, **vars(args))
        log.info('wrote %s', spec_file)


    if is_pyi30:
        parser = optparse.OptionParser(usage=('%prog [opts] <scriptname> [ '
                                              '<scriptname> ...] | <specfil'
                                              'e>'))
        _pyi_makespec.__add_options(parser)
        _pyi_log.__add_options(parser)
        _pyi_compat.__add_obsolete_options(parser)

        opts, args = parser.parse_args(pyi_args)
        _pyi_log.__process_options(parser, opts)

        run_makespec(args, opts)
    else:
        parser = argparse.ArgumentParser()
        _pyi_makespec.__add_options(parser)
        _pyi_log.__add_options(parser)
        _pyi_compat.__add_obsolete_options(parser)
        parser.add_argument('scriptname', nargs='+')

        args = parser.parse_args(pyi_args)

        # We call init because it loads logger into the global
        # namespace of the Pyinstaller.log module. logger is used
        # in the Pyinstaller.log.__process_options call
        _pyi_log.init()
        _pyi_log.__process_options(parser, args)

        run_makespec(args)
Beispiel #3
0
def pyi_makespec(pyi_args):  # pragma: no cover
    """Wrapper to configure make_spec for multipule pyinstaller versions"""

    def run_makespec(_args):
        """Setup args & run make_spec command"""
        # Split pathex by using the path separator
        temppaths = _args.pathex[:]
        _args.pathex = []
        for p in temppaths:
            _args.pathex.extend(p.split(os.pathsep))

        # Fix for issue #4 - Not searching cwd for modules
        _args.pathex.insert(0, os.getcwd())

        spec_file = _pyi_makespec.main(_args.scriptname, **vars(_args))
        log.debug("wrote %s", spec_file)

    parser = argparse.ArgumentParser()
    # We are hacking into pyinstaller here & are aware of the risks
    # using noqa below so landscape.io will ignore it
    _pyi_makespec.__add_options(parser)  # noqa
    _pyi_log.__add_options(parser)  # noqa
    if hasattr(_pyi_compat, "__add_obsolete_options"):
        _pyi_compat.__add_obsolete_options(parser)  # noqa
    # End hacking
    parser.add_argument("scriptname", nargs="+")

    args = parser.parse_args(pyi_args)

    # We call init because it loads logger into the global
    # namespace of the Pyinstaller.log module. logger is used
    # in the Pyinstaller.log.__process_options call
    if hasattr(_pyi_log, "init"):
        _pyi_log.init()
    # We are hacking into pyinstaller here & are aware of the risks
    # using noqa below so landscape.io will ignore it
    _pyi_log.__process_options(parser, args)  # noqa
    # End hacking

    run_makespec(args)

    return True
Beispiel #4
0
def pyi_makespec(pyi_args):
    def run_makespec(opts, args):
        # Split pathex by using the path separator
        temppaths = opts.pathex[:]
        opts.pathex = []
        for p in temppaths:
            opts.pathex.extend(p.split(os.pathsep))

        spec_file = _pyi_makespec.main(args, **opts.__dict__)
        log.info('wrote %s' % spec_file)

    parser = optparse.OptionParser(usage=('%prog [opts] <scriptname> '
                                          '[ <scriptname> ...] | <specfile>'))

    _pyi_makespec.__add_options(parser)
    _pyi_build.__add_options(parser)
    _pyi_log.__add_options(parser)
    _pyi_compat.__add_obsolete_options(parser)

    opts, args = parser.parse_args(pyi_args)
    _pyi_log.__process_options(parser, opts)

    run_makespec(opts, args)
Beispiel #5
0
def pyi_makespec(pyi_args):  # pragma: no cover
    """Wrapper to configure make_spec for multipule pyinstaller versions"""
    def run_makespec(args, opts=None):
        """Setup args & run make_spec command"""
        if is_pyi30:
            # Split pathex by using the path separator
            temppaths = opts.pathex[:]
            opts.pathex = []
            for p in temppaths:
                opts.pathex.extend(p.split(os.pathsep))

            # Fix for issue #4 - Not searching cwd for modules
            opts.pathex.insert(0, os.getcwd())

            spec_file = _pyi_makespec.main(args, **opts.__dict__)
        else:
            # Split pathex by using the path separator
            temppaths = args.pathex[:]
            args.pathex = []
            for p in temppaths:
                args.pathex.extend(p.split(os.pathsep))

            # Fix for issue #4 - Not searching cwd for modules
            args.pathex.insert(0, os.getcwd())

            spec_file = _pyi_makespec.main(args.scriptname, **vars(args))
        log.info('wrote %s', spec_file)

    if is_pyi30:
        # We will exit with an error message in builder.py
        if optparse is None:
            log.debug('optparse is not available in this python distribution')
            return False
        parser = optparse.OptionParser(usage=('%prog [opts] <scriptname> [ '
                                              '<scriptname> ...] | <specfil'
                                              'e>'))
        # We are hacking into pyinstaller here & are aware of the risks
        # using noqa below so landscape.io will ignore it
        _pyi_makespec.__add_options(parser)  # noqa
        _pyi_log.__add_options(parser)  # noqa
        _pyi_compat.__add_obsolete_options(parser)  # noqa
        # End hacking
        opts, args = parser.parse_args(pyi_args)
        # We are hacking into pyinstaller here & are aware of the risks
        # using noqa below so landscape.io will ignore it
        _pyi_log.__process_options(parser, opts)  # noqa
        # End hacking

        run_makespec(args, opts)
    else:
        parser = argparse.ArgumentParser()
        # We are hacking into pyinstaller here & are aware of the risks
        # using noqa below so landscape.io will ignore it
        _pyi_makespec.__add_options(parser)  # noqa
        _pyi_log.__add_options(parser)  # noqa
        _pyi_compat.__add_obsolete_options(parser)  # noqa
        # End hacking
        parser.add_argument('scriptname', nargs='+')

        args = parser.parse_args(pyi_args)

        # We call init because it loads logger into the global
        # namespace of the Pyinstaller.log module. logger is used
        # in the Pyinstaller.log.__process_options call
        _pyi_log.init()
        # We are hacking into pyinstaller here & are aware of the risks
        # using noqa below so landscape.io will ignore it
        _pyi_log.__process_options(parser, args) # noqa
        # End hacking

        run_makespec(args)

    return True
def pyi_makespec(pyi_args):  # pragma: no cover
    """Wrapper to configure make_spec for multipule pyinstaller versions"""
    def run_makespec(args, opts=None):
        """Setup args & run make_spec command"""
        if is_pyi30:
            # Split pathex by using the path separator
            temppaths = opts.pathex[:]
            opts.pathex = []
            for p in temppaths:
                opts.pathex.extend(p.split(os.pathsep))

            # Fix for issue #4 - Not searching cwd for modules
            opts.pathex.insert(0, os.getcwd())

            spec_file = _pyi_makespec.main(args, **opts.__dict__)
        else:
            # Split pathex by using the path separator
            temppaths = args.pathex[:]
            args.pathex = []
            for p in temppaths:
                args.pathex.extend(p.split(os.pathsep))

            # Fix for issue #4 - Not searching cwd for modules
            args.pathex.insert(0, os.getcwd())

            spec_file = _pyi_makespec.main(args.scriptname, **vars(args))
        log.info('wrote %s', spec_file)

    if is_pyi30:
        # We will exit with an error message in builder.py
        if optparse is None:
            log.debug('optparse is not available in this python distribution')
            return False
        parser = optparse.OptionParser(usage=('%prog [opts] <scriptname> [ '
                                              '<scriptname> ...] | <specfil'
                                              'e>'))
        # We are hacking into pyinstaller here & are aware of the risks
        # using noqa below so landscape.io will ignore it
        _pyi_makespec.__add_options(parser)  # noqa
        _pyi_log.__add_options(parser)  # noqa
        _pyi_compat.__add_obsolete_options(parser)  # noqa
        # End hacking
        opts, args = parser.parse_args(pyi_args)
        # We are hacking into pyinstaller here & are aware of the risks
        # using noqa below so landscape.io will ignore it
        _pyi_log.__process_options(parser, opts)  # noqa
        # End hacking

        run_makespec(args, opts)
    else:
        parser = argparse.ArgumentParser()
        # We are hacking into pyinstaller here & are aware of the risks
        # using noqa below so landscape.io will ignore it
        _pyi_makespec.__add_options(parser)  # noqa
        _pyi_log.__add_options(parser)  # noqa
        _pyi_compat.__add_obsolete_options(parser)  # noqa
        # End hacking
        parser.add_argument('scriptname', nargs='+')

        args = parser.parse_args(pyi_args)

        # We call init because it loads logger into the global
        # namespace of the Pyinstaller.log module. logger is used
        # in the Pyinstaller.log.__process_options call
        _pyi_log.init()
        # We are hacking into pyinstaller here & are aware of the risks
        # using noqa below so landscape.io will ignore it
        _pyi_log.__process_options(parser, args)  # noqa
        # End hacking

        run_makespec(args)

    return True