コード例 #1
0
def get_version(*file_paths):
    """
    Extract the version string from the file at the given relative path fragments.
    """
    filename = os.path.join(os.path.dirname(__file__), *file_paths)
    version_file = open_as_of_py3(filename, encoding='utf-8').read()
    version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]",
                              version_file, re.M)
    if version_match:
        return version_match.group(1)
    raise RuntimeError('Unable to find version string.')
コード例 #2
0
def load_requirements(*requirements_paths):
    """
    Load all requirements from the specified requirements files.

    Returns:
        list: Requirements file relative path strings
    """
    requirements = set()
    for path in requirements_paths:
        requirements.update(
            line.split('#')[0].strip()
            for line in open_as_of_py3(path, encoding='utf-8').readlines()
            if is_requirement(line.strip()))
    return list(requirements)
コード例 #3
0
ファイル: setup.py プロジェクト: icarrr/edx-ora2
#!/usr/bin/env python

import os.path
from io import open as open_as_of_py3

from setuptools import setup, find_packages

README = open_as_of_py3(os.path.join(os.path.dirname(__file__),
                                     'README.rst')).read()


def is_requirement(line):
    """
    Return True if the requirement line is a package requirement;
    that is, it is not blank, a comment, a URL, or an included file.
    """
    return line and not line.startswith(('-r', '#', '-e', 'git+', '-c'))


def load_requirements(*requirements_paths):
    """
    Load all requirements from the specified requirements files.
    Returns a list of requirement strings.
    """
    requirements = set()
    for path in requirements_paths:
        with open(path) as reqs:
            requirements.update(
                line.split('#')[0].strip() for line in reqs
                if is_requirement(line.strip()))
    return list(requirements)
コード例 #4
0
    Returns:
        bool: True if the line is not blank, a comment, a URL, or an included file
    """
    return line and not line.startswith(('-r', '#', '-e', 'git+', '-c'))


VERSION = get_version('super_csv', '__init__.py')

if sys.argv[-1] == 'tag':
    print("Tagging the version on github:")
    os.system(u"git tag -a %s -m 'version %s'" % (VERSION, VERSION))
    os.system("git push --tags")
    sys.exit()

README = open_as_of_py3(os.path.join(os.path.dirname(__file__), 'README.rst'),
                        encoding='utf-8').read()
CHANGELOG = open_as_of_py3(os.path.join(os.path.dirname(__file__),
                                        'CHANGELOG.rst'),
                           encoding='utf-8').read()

setup(name='super-csv',
      version=VERSION,
      description="""CSV Processor""",
      long_description=README + '\n\n' + CHANGELOG,
      author='edX',
      author_email='*****@*****.**',
      url='https://github.com/edx/super-csv',
      packages=[
          'super_csv',
      ],
      include_package_data=True,