from efilter.version import get_txt_version, get_version except ImportError: # If we can't import EFILTER then we can't generate version from git, but # can still just read the version file. def get_version(_=None): return get_txt_version() def get_txt_version(): try: with open("version.txt", "r") as fp: return fp.read().strip() except IOError: return None __version__ = get_txt_version() class BdistRPMCommand(bdist_rpm): """Custom handler for the bdist_rpm command.""" def _make_spec_file(self): """Generates the text of an RPM spec file. Returns: A list of strings containing the lines of text. """ # Note that bdist_rpm can be an old style class. if issubclass(BdistRPMCommand, object): spec_file = super(BdistRPMCommand, self)._make_spec_file() else:
def get_version(_=None): return get_txt_version()
from setuptools.commands.bdist_rpm import bdist_rpm except ImportError: from distutils.command.bdist_rpm import bdist_rpm try: from setuptools.command.sdist import sdist except ImportError: from distutils.command.sdist import sdist # Change PYTHONPATH to include efilter so that we can get the version. sys.path.insert(0, ".") from efilter import version __version__ = version.get_txt_version() class BdistRPMCommand(bdist_rpm): """Custom handler for the bdist_rpm command.""" def _make_spec_file(self): """Generates the text of an RPM spec file. Returns: A list of strings containing the lines of text. """ # Note that bdist_rpm can be an old style class. if issubclass(BdistRPMCommand, object): spec_file = super(BdistRPMCommand, self)._make_spec_file() else: