Ejemplo n.º 1
0
def main():
    parser = OptionParser()

    parser.add_option("--verbose",
                      action="store_true",
                      dest="verbose",
                      default=False,
                      help="""\
        Default is %default.""")

    _options, positional_args = parser.parse_args()

    if not positional_args:
        positional_args = ["bin", "nuitka"]

    print("Working on:", positional_args)

    positional_args = [
        os.path.abspath(positional_arg) for positional_arg in positional_args
    ]
    goHome()

    found = False
    for filename in scanTargets(positional_args):
        autoformat(filename)
        found = True

    if not found:
        sys.exit("No files found.")
Ejemplo n.º 2
0
def main():
    goHome()

    # So PyLint finds nuitka package.
    addPYTHONPATH(os.getcwd())
    setupPATH()

    parser = OptionParser()

    parser.add_option("--show-todos",
                      "--todos",
                      action="store_true",
                      dest="todos",
                      default=False,
                      help="""\
Show TODO items. Default is %default.""")

    parser.add_option("--verbose",
                      action="store_true",
                      dest="verbose",
                      default=False,
                      help="""\
Be version in output. Default is %default.""")

    parser.add_option("--one-by-one",
                      action="store_true",
                      dest="one_by_one",
                      default=False,
                      help="""\
Check files one by one. Default is %default.""")

    options, positional_args = parser.parse_args()

    if not positional_args:
        positional_args = ["bin", "nuitka"]

    print("Working on:", positional_args)

    blacklist = (
        "oset.py",
        "odict.py",
        "SyntaxHighlighting.py",
    )

    filenames = list(scanTargets(positional_args, blacklist))
    PyLint.executePyLint(filenames, options.todos, options.verbose,
                         options.one_by_one)

    if not filenames:
        sys.exit("No files found.")

    sys.exit(PyLint.our_exit_code)
Ejemplo n.º 3
0
def main():
    goHome()

    # So PyLint finds nuitka package.
    addPYTHONPATH(os.getcwd())

    target_files = []
    for filename in scanTargets(["nuitka", "bin"]):
        target_files.append(filename)

    target_files.append("nuitka/build/SingleExe.scons")

    setupPATH()
    subprocess.check_call(["isort", "-ot", "-m3", "-ns", "__init__.py"] +
                          target_files)
Ejemplo n.º 4
0
def main():
    goHome()

    # So isort finds nuitka package.
    addPYTHONPATH(os.getcwd())

    parser = OptionParser()

    parser.add_option("--verbose",
                      action="store_true",
                      dest="verbose",
                      default=False,
                      help="""\
        Default is %default.""")

    _options, positional_args = parser.parse_args()

    if not positional_args:
        positional_args = [
            "bin", "nuitka", "tests/reflected/compile_itself.py"
        ]

    target_files = []
    for filename in scanTargets(positional_args):

        package_name = os.path.dirname(filename)
        if package_name.startswith("nuitka" + os.path.sep):
            package_name = package_name.replace(os.path.sep, '.')

            source_code = open(filename).read()
            updated_code = re.sub(r"from %s import" % package_name,
                                  "from . import", source_code)
            updated_code = re.sub(r"from %s\." % package_name, "from .",
                                  source_code)

            if source_code != updated_code:
                with open(filename, 'w') as out_file:
                    out_file.write(updated_code)

        target_files.append(filename)

    target_files.append("nuitka/build/SingleExe.scons")

    setupPATH()
    subprocess.check_call(["isort", "-ot", "-m3", "-ns", "__init__.py"] +
                          target_files)
Ejemplo n.º 5
0
def main():
    goHome()

    # So PyLint finds nuitka package.
    addPYTHONPATH(os.getcwd())

    parser = OptionParser()

    parser.add_option("--show-todos",
                      "--todos",
                      action="store_true",
                      dest="todos",
                      default=False,
                      help="""\
        Default is %default.""")

    parser.add_option("--verbose",
                      action="store_true",
                      dest="verbose",
                      default=False,
                      help="""\
        Default is %default.""")

    options, positional_args = parser.parse_args()

    if not positional_args:
        positional_args = ["bin", "nuitka"]

    print("Working on:", positional_args)

    blacklist = (
        "oset.py",
        "odict.py",
        "SyntaxHighlighting.py",
    )

    found = False
    for filename in scanTargets(positional_args, blacklist):
        executePyLint(filename, options.todos, options.verbose)
        found = True

    if not found:
        sys.exit("No files found.")
Ejemplo n.º 6
0
def main():
    goHome()

    # So isort finds nuitka package.
    addPYTHONPATH(os.getcwd())

    parser = OptionParser()

    parser.add_option(
        "--verbose",
        action  = "store_true",
        dest    = "verbose",
        default = False,
        help    = """\
        Default is %default."""
    )

    _options, positional_args = parser.parse_args()

    if not positional_args:
        positional_args = ["bin", "nuitka", "tests/reflected/compile_itself.py"]

    target_files = []
    for filename in scanTargets(positional_args):
        target_files.append(filename)

    target_files.append("nuitka/build/SingleExe.scons")

    setupPATH()
    subprocess.check_call(
        [
            "isort",
            "-ot",
            "-m3",
            "-ns",
            "__init__.py"
        ] + target_files
    )