示例#1
0
 def get_setup_cfg(_, extracted_files: Iterable[str]) -> Any:
     setup_cfg_candidates = [
         filepath for filepath in extracted_files
         if os.path.basename(filepath) == "setup.cfg"
     ]
     if setup_cfg_candidates:
         return setupcfg.load(setup_cfg_candidates[0])
示例#2
0
def _cli(keywords=None):
    cfg = setupcfg.load()
    if keywords is not None:
        cfg[SECTION][KEY] = keywords
        cfg.save()
    else:
        if KEY in cfg[SECTION]:
            print(cfg[SECTION][KEY])
示例#3
0
def _cli(name=None):
    cfg = setupcfg.load()
    if name is not None:
        cfg[SECTION][KEY] = name
        cfg.save()
    else:
        if KEY in cfg[SECTION]:
            print(cfg[SECTION][KEY])
示例#4
0
def _cli(url=None):
    cfg = setupcfg.load()
    if url is not None:
        cfg[SECTION][KEY] = url
        cfg.save()
    else:
        if KEY in cfg[SECTION]:
            print(cfg[SECTION][KEY])
示例#5
0
def _cli(description=None):
    cfg = setupcfg.load()
    if description is not None:
        cfg[SECTION][KEY] = description
        cfg.save()
    else:
        if KEY in cfg[SECTION]:
            print(cfg[SECTION][KEY])
示例#6
0
def _cli(py_modules=None):
    cfg = setupcfg.load()
    if py_modules:
        cfg[SECTION][KEY] = py_modules
        if not py_modules[0]:
            del cfg[SECTION][KEY]
        cfg.save()
    else:
        if KEY in cfg[SECTION]:
            print("\n".join(cfg[SECTION][KEY]))
示例#7
0
def _cli(install_requires=None):
    cfg = setupcfg.load()
    if install_requires:
        cfg[SECTION][KEY] = install_requires
        if not install_requires[0]:
            del cfg[SECTION][KEY]
        cfg.save()
    else:
        if KEY in cfg[SECTION]:
            print("\n".join(cfg[SECTION][KEY]))
示例#8
0
#!/usr/bin/env python
import os
import setupcfg

os.chdir(os.path.dirname(__file__))

data = setupcfg.load()
print(data)
示例#9
0
 def getname(self):
     if os.path.exists("setup.cfg"):
         metadata = setupcfg.load().get("metadata", {})
         return metadata.get("name")
     return os.popen("python setup.py --name").read().strip()