예제 #1
0
def run(inpath, tmpldict, outpath=None, execute=None, runargs=None):
    """Handles logic for `run` command."""
    if not outpath:
        outpath = op.join(os.getcwd(), "__temp-poppage-" + _getrands(6))
    make(inpath, tmpldict, outpath=outpath)
    qprompt.hrule()
    if not execute:
        execute = outpath
    tmpldict.update({'outpath': outpath})
    tmpldict.update({'runargs': " ".join(runargs or [])})
    execute = render_str(execute, tmpldict)
    for line in execute.splitlines():
        sh.call(line.strip())
    fsys.delete(outpath)
예제 #2
0
파일: _Build.py 프로젝트: jeffrimko/Qprompt
def readme_excerpt():
    tempxml = "temp.xml"
    shell.call(f"asciidoctor -b docbook -o {tempxml} README.adoc")
    e = ElementTree.parse(tempxml).getroot()
    fsys.delete(tempxml)
    ns = {'db': 'http://docbook.org/ns/docbook', 'xml': 'http://www.w3.org/XML/1998/namespace'}
    rst = ""
    for sect in ["_introduction", "_status", "_requirements", "_installation"]:
        xml = ElementTree.tostring(e.find(f".//db:section[@xml:id='{sect}']", ns)).decode("utf-8")
        fsys.File(tempxml).write(xml)
        rst += shell.strout(f"pandoc -r docbook -w rst --base-header-level=2 {tempxml}")
        rst += "\n\n"
    fsys.File(r"doc\source\readme_excerpt.rst").write(rst)
    fsys.delete(tempxml)
    print("Readme excerpt generated.")
예제 #3
0
def readme_excerpt():
    tempxml = "temp.xml"
    shell.call(f"asciidoctor -b docbook -o {tempxml} README.adoc")
    e = ElementTree.parse(tempxml).getroot()
    fsys.delete(tempxml)
    ns = {
        'db': 'http://docbook.org/ns/docbook',
        'xml': 'http://www.w3.org/XML/1998/namespace'
    }
    rst = ""
    for sect in ["_introduction", "_status", "_requirements", "_installation"]:
        xml = ElementTree.tostring(
            e.find(f".//db:section[@xml:id='{sect}']", ns)).decode("utf-8")
        fsys.File(tempxml).write(xml)
        rst += shell.strout(
            f"pandoc -r docbook -w rst --base-header-level=2 {tempxml}")
        rst += "\n\n"
    fsys.File(r"doc\source\readme_excerpt.rst").write(rst)
    fsys.delete(tempxml)
    print("Readme excerpt generated.")
예제 #4
0
def install_package_locally():
    with fsys.Cwd("lib", __file__):
        shell.call("_Install_Package.py")
예제 #5
0
def run_tests():
    with fsys.Cwd("tests", __file__):
        shell.call("_Run_Tests.py")
예제 #6
0
def check_version():
    with fsys.Cwd(".", __file__):
        shell.call("_Check_Versions.py")
예제 #7
0
def cleanup():
    with fsys.Cwd("lib"):
        shell.call("_Cleanup.bat")
    with fsys.Cwd("doc"):
        shell.call("make clean")
예제 #8
0
import qprompt

sys.path.append("..")
sys.dont_write_bytecode = True

from _Check_Versions import VERCHK
from _Install_Package import generate_readme, cleanup_readme

##==============================================================#
## SECTION: Main Body                                           #
##==============================================================#

if __name__ == '__main__':
    pause = True
    if len(sys.argv) > 1 and "nopause" == sys.argv[1]:
        pause = False
    ver = VERCHK.run()
    if not ver:
        qprompt.alert("Issue with version info!")
        sys.exit(1)
    if 0 != qprompt.status("Running tests...", sh.silent, [r"..\tests\_Run_Tests.py nopause"]):
        qprompt.alert("Issue running tests!")
        sys.exit(1)
    if qprompt.ask_yesno("Upload version `%s`?" % (ver)):
        generate_readme()
        sh.call("python setup.py sdist upload")
        cleanup_readme()
    if pause:
        qprompt.pause()
    sys.exit(0)
예제 #9
0
def all_docs():
    readme_excerpt()
    with fsys.Cwd("doc", __file__):
        shell.call("make html")
예제 #10
0
파일: _Build.py 프로젝트: jeffrimko/PopPage
def install_package_locally():
    with fsys.Cwd("app", __file__):
        shell.call("_Install_Package.py")
예제 #11
0
파일: _Build.py 프로젝트: jeffrimko/PopPage
def run_tests():
    with fsys.Cwd("tests", __file__):
        shell.call("_Run_Tests.py")
예제 #12
0
파일: _Build.py 프로젝트: jeffrimko/PopPage
def check_version():
    with fsys.Cwd(".", __file__):
        shell.call("_Check_Versions.py")
예제 #13
0
파일: _Build.py 프로젝트: jeffrimko/PopPage
def cleanup():
    with fsys.Cwd("app"):
        shell.call("_Cleanup.py")
예제 #14
0
파일: _Build.py 프로젝트: jeffrimko/Qprompt
def all_docs():
    readme_excerpt()
    with fsys.Cwd("doc", __file__):
        shell.call("make html")
예제 #15
0
def upload_to_pypi():
    with fsys.Cwd("lib", __file__):
        shell.call("_Upload_PyPI.py")
예제 #16
0
파일: _Build.py 프로젝트: jeffrimko/PopPage
def upload_to_pypi():
    with fsys.Cwd("app", __file__):
        shell.call("_Upload_PyPI.py")
예제 #17
0
def cleanup():
    with fsys.Cwd("app"):
        shell.call("_Cleanup.py")
예제 #18
0
def call(args, app_path="../app"):
    """Call PopPage as a CLI utility."""
    cmd = "python %s/poppage.py " % (app_path) + args
    print(cmd)
    return sh.call(cmd)
예제 #19
0
파일: _Build.py 프로젝트: jeffrimko/Qprompt
def cleanup():
    with fsys.Cwd("lib"):
        shell.call("_Cleanup.bat")
    with fsys.Cwd("doc"):
        shell.call("make clean")