예제 #1
0
파일: setup.py 프로젝트: gle2d/pyensae
 def run(self):
     if self.g is None:
         raise RuntimeError(
             "Expecting a grammar file: python setup.py update_grammars R.g4"
         )
     grammar = self.g
     from pyensae.languages import build_grammar
     if not os.path.exists(grammar):
         cdir = os.path.abspath(os.path.dirname(__file__))
         g2 = os.path.join(cdir, "src", "pyensae", "languages", grammar)
         if not os.path.exists(g2):
             raise FileNotFoundError("{0}\n{1}".format(grammar, g2))
         grammar = g2
     build_grammar(grammar, fLOG=logging_function)
     r = True
예제 #2
0
파일: setup.py 프로젝트: sdpython/jupytalk
 def run(self):
     if self.g is None:
         raise RuntimeError(
             "Expecting a grammar file: python setup.py update_grammars R.g4"
         )
     grammar = self.g
     from pyensae.languages import build_grammar
     if not os.path.exists(grammar):
         cdir = os.path.abspath(os.path.dirname(__file__))
         g2 = os.path.join(cdir, "src", "jupytalk", "mokadi", "grammars",
                           grammar)
         if not os.path.exists(g2):
             raise FileNotFoundError("{0}\n{1}".format(grammar, g2))
         grammar = g2
     try:
         from pyensae.languages import build_grammar
     except ImportError:
         sys.path.append(
             os.path.join(os.path.dirname(__file__), "..", "pyensae",
                          "src"))
         from pyensae.languages import build_grammar
     build_grammar(grammar, fLOG=logging_function)
예제 #3
0
파일: setup.py 프로젝트: gaardhus/pyensae
        if len(sys.argv) <= ind:
            raise Exception(
                "expecting a grammar file: python setup.py update_grammars R.g4"
            )
        grammar = sys.argv[ind + 1]
        try:
            from pyensae.languages import build_grammar
        except ImportError:
            from src.pyensae.languages import build_grammar
        if not os.path.exists(grammar):
            cdir = os.path.abspath(os.path.dirname(__file__))
            g2 = os.path.join(cdir, "src", "pyensae", "languages", grammar)
            if not os.path.exists(g2):
                raise FileNotFoundError("{0}\n{1}".format(grammar, g2))
            grammar = g2
        build_grammar(grammar, fLOG=logging_function)
        r = True
    if not r and not ({
            "bdist_msi", "sdist", "bdist_wheel", "publish", "publish_doc",
            "register", "upload_docs", "bdist_wininst", "build_ext"
    } & set(sys.argv)):
        raise Exception("unable to interpret command line: " + str(sys.argv))
else:
    r = False

if ask_help():
    from pyquickhelper.pycode import process_standard_options_for_setup_help
    process_standard_options_for_setup_help(sys.argv)

if not r:
예제 #4
0
파일: setup.py 프로젝트: sdpython/jupytalk
                "Expecting a grammar file: python setup.py update_grammars MokadiGrammar.g4")
        grammar = sys.argv[ind + 1]
        if not os.path.exists(grammar):
            cdir = os.path.abspath(os.path.dirname(__file__))
            g2 = os.path.join(cdir, "src", "jupytalk",
                              "mokadi", "grammars", grammar)
            if not os.path.exists(g2):
                raise FileNotFoundError("{0}\n{1}".format(grammar, g2))
            grammar = g2
        try:
            from pyensae.languages import build_grammar
        except ImportError:
            sys.path.append(os.path.join(
                os.path.dirname(__file__), "..", "pyensae", "src"))
            from pyensae.languages import build_grammar
        build_grammar(grammar, fLOG=logging_function)
        r = True
    if not r and not ({"bdist_msi", "sdist",
                       "bdist_wheel", "publish", "publish_doc", "register",
                       "upload_docs", "bdist_wininst", "build_ext"} & set(sys.argv)):
        raise Exception("unable to interpret command line: " + str(sys.argv))
else:
    r = False

if ask_help():
    from pyquickhelper.pycode import process_standard_options_for_setup_help
    process_standard_options_for_setup_help(sys.argv)

if not r:
    if len(sys.argv) in (1, 2) and sys.argv[-1] in ("--help-commands",):
        from pyquickhelper.pycode import process_standard_options_for_setup_help
예제 #5
0
                  "'_UT_35_std' in outfile"))
    if not r and "update_grammars" in sys.argv:
        # expecting python setup.py update_grammars file
        ind = sys.argv.index("update_grammars")
        if len(sys.argv) <= ind:
            raise Exception(
                "expecting a grammar file: python setup.py update_grammars R.g4"
            )
        grammar = sys.argv[ind + 1]
        if not os.path.exists(grammar):
            g2 = os.path.join("src", "pyensae", "languages", grammar)
            if not os.path.exists(g2):
                raise FileNotFoundError(grammar)
            grammar = g2
        from pyensae.languages import build_grammar
        build_grammar(grammar)
        r = True
    if not r and not ({
            "bdist_msi", "sdist", "bdist_wheel", "publish", "publish_doc",
            "register", "upload_docs", "bdist_wininst"
    } & set(sys.argv)):
        raise Exception("unable to interpret command line: " + str(sys.argv))
else:
    r = False

if not r:
    if len(sys.argv) in (1, 2) and sys.argv[-1] in ("--help-commands", ):
        pyquickhelper = import_pyquickhelper()
        from pyquickhelper.pycode import process_standard_options_for_setup_help
        process_standard_options_for_setup_help(sys.argv)
예제 #6
0
            omit=["*Parser.py", "*Listener.py", "*Lexer.py"]),
        fLOG=logging_function, covtoken=("f929c9b3-bf00-4928-906a-b1dc54d5a5d9", "'_UT_35_std' in outfile"))
    if not r and "update_grammars" in sys.argv:
        # expecting python setup.py update_grammars file
        ind = sys.argv.index("update_grammars")
        if len(sys.argv) <= ind:
            raise Exception(
                "expecting a grammar file: python setup.py update_grammars R.g4")
        grammar = sys.argv[ind + 1]
        if not os.path.exists(grammar):
            g2 = os.path.join("src", "pyensae", "languages", grammar)
            if not os.path.exists(g2):
                raise FileNotFoundError(grammar)
            grammar = g2
        from pyensae.languages import build_grammar
        build_grammar(grammar)
        r = True
    if not r and not ({"bdist_msi", "sdist",
                       "bdist_wheel", "publish", "publish_doc", "register",
                       "upload_docs", "bdist_wininst"} & set(sys.argv)):
        raise Exception("unable to interpret command line: " + str(sys.argv))
else:
    r = False

if not r:
    if len(sys.argv) in (1, 2) and sys.argv[-1] in ("--help-commands",):
        pyquickhelper = import_pyquickhelper()
        from pyquickhelper.pycode import process_standard_options_for_setup_help
        process_standard_options_for_setup_help(sys.argv)

    setup(