How to use the rpg.utils.str_to_pkgname function in rpg

To help you get started, we’ve selected a few rpg examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rh-lab-q / rpg / rpg / plugins / project_builder / cmake.py View on Github external
def extracted(self, project_dir, spec, sack):
        if (project_dir / "CMakeLists.txt").is_file():
            regex = re.compile(
                r"project\s*\((.*?)(?:\s(.*?))?[\s\)]",
                re.IGNORECASE | re.DOTALL)
            with (project_dir / "CMakeLists.txt").open() as f:
                result = regex.search(f.read())
                if result.group(1):
                    spec.Name = str_to_pkgname(result.group(1))
                if result.group(2):
                    spec.Version = result.group(2)
github rh-lab-q / rpg / rpg / plugins / project_builder / maven.py View on Github external
def extracted(self, project_dir, spec, sack):
        if (project_dir / "pom.xml").is_file():
            et = etree.parse(str(project_dir / "pom.xml")).getroot()
            for branch in et:
                tag = re.sub(r'^{.*?}', '', str(branch.tag))
                if tag == 'name':
                    spec.Name = str_to_pkgname(branch.text.strip())
                elif tag == 'version':
                    spec.Version = re.sub('-SNAPSHOT', '', branch.text.strip())
                elif tag == 'description':
                    spec.description = branch.text.strip()
                elif tag == 'url':
                    spec.URL = branch.text.strip()
github rh-lab-q / rpg / rpg / plugins / project_builder / autotools.py View on Github external
def extracted(self, project_dir, spec, sack):
        if (project_dir / "configure.ac").is_file():
            regex = re.compile(
                r"AC_INIT\s*\(\s*\[?\s*?(.*?)\s*\]?\s*,\s*"
                r"\[?\s*?(.*?)\s*\]?\s*?[,)]",
                re.IGNORECASE | re.DOTALL)
            with (project_dir / "configure.ac").open() as f:
                result = regex.search(f.read())
                if result.group(1):
                    spec.Name = str_to_pkgname(result.group(1))
                if result.group(2):
                    spec.Version = result.group(2)
github rh-lab-q / rpg / rpg / plugins / project_builder / setuptools.py View on Github external
def extracted(self, project_dir, spec, sack):
        if (project_dir / "setup.py").is_file():
            with (project_dir / "setup.py").open() as f:
                matches = re.findall(
                    r'(name|version|description|license|url)'
                    r'\s*=\s*\(?"(.*?)"\)?\s*,',
                    f.read(), re.IGNORECASE | re.DOTALL)
            for match in matches:
                if match[0] == "name":
                    spec.Name = str_to_pkgname(match[1])
                elif match[0] == "version":
                    spec.Version = match[1]
                elif match[0] == "description":
                    spec.description = re.sub(r'\".*?\"', '', match[1])
                elif match[0] == "license":
                    spec.License = match[1]
                elif match[0] == "url":
                    spec.URL = match[1]