lrossett / centos / centpkg

Forked from centos/centpkg 4 years ago
Clone
Brian Stinson d0f4ad
from setuptools import setup
1a5430
Michal Konečný 657b11
def get_requirements(requirements_file="requirements.txt"):
Michal Konečný 657b11
    """Get the contents of a file listing the requirements.
Michal Konečný 657b11
Michal Konečný 657b11
    :arg requirements_file: path to a requirements file
Michal Konečný 657b11
    :type requirements_file: string
Michal Konečný 657b11
    :returns: the list of requirements, or an empty list if
Michal Konečný 657b11
              `requirements_file` could not be opened or read
Michal Konečný 657b11
    :return type: list
Michal Konečný 657b11
    """
Michal Konečný 657b11
Michal Konečný 657b11
    lines = open(requirements_file).readlines()
Michal Konečný 657b11
    dependencies = []
Michal Konečný 657b11
    for line in lines:
Michal Konečný 657b11
        maybe_dep = line.strip()
Michal Konečný 657b11
        if maybe_dep.startswith("#"):
Michal Konečný 657b11
            # Skip pure comment lines
Michal Konečný 657b11
            continue
Michal Konečný 657b11
        if maybe_dep.startswith("git+"):
Michal Konečný 657b11
            # VCS reference for dev purposes, expect a trailing comment
Michal Konečný 657b11
            # with the normal requirement
Michal Konečný 657b11
            __, __, maybe_dep = maybe_dep.rpartition("#")
Michal Konečný 657b11
        else:
Michal Konečný 657b11
            # Ignore any trailing comment
Michal Konečný 657b11
            maybe_dep, __, __ = maybe_dep.partition("#")
Michal Konečný 657b11
        # Remove any whitespace and assume non-empty results are dependencies
Michal Konečný 657b11
        maybe_dep = maybe_dep.strip()
Michal Konečný 657b11
        if maybe_dep:
Michal Konečný 657b11
            dependencies.append(maybe_dep)
Michal Konečný 657b11
    return dependencies
Michal Konečný 657b11
Brian Stinson d0f4ad
setup(
175790
    name="centpkg",
56420e
    version='0.6.4',
175790
    author="Brian Stinson",
Brian Stinson 3b4c6d
    author_email="bstinson@redhat.com",
175790
    description="CentOS Plugin to rpkg for managing RPM package sources",
175790
    license="GPLv2+",
175790
    package_dir={'': 'src'},
175790
    packages=['centpkg'],
Michal Konečný 657b11
    install_requires=get_requirements(),
Michal Konečný 0d832c
    scripts=['src/bin/centpkg', 'src/bin/centpkg-sig'],
Brian Stinson d0f4ad
)