def get_setup_py_version(self): if os.path.exists('setup.py'): # First run egg_info, as that may get rid of some warnings # that otherwise end up in the extracted version, like # UserWarnings. system(utils.setup_py('egg_info')) version = system(utils.setup_py('--version')) return utils.strip_version(version)
def get_version_txt_version(self): filenames = ['version'] for extension in TXT_EXTENSIONS: filenames.append('.'.join(['version', extension])) version_file = self.filefind(filenames) if version_file: f = open(version_file, 'r') version = f.read() return utils.strip_version(version)
def get_python_file_version(self): setup_cfg = pypi.SetupConfig() if not setup_cfg.python_file_with_version(): return lines = open(setup_cfg.python_file_with_version()).read().split('\n') for line in lines: match = UNDERSCORED_VERSION_PATTERN.search(line) if match: logger.debug("Matching __version__ line found: %r", line) line = line.lstrip('__version__').strip() line = line.lstrip('=').strip() line = line.replace('"', '').replace("'", "") return utils.strip_version(line)
def get_setup_py_version(self): if os.path.exists('setup.py'): # First run egg_info, as that may get rid of some warnings # that otherwise end up in the extracted version, like # UserWarnings. system(utils.setup_py('egg_info')) version = system(utils.setup_py('--version')).splitlines()[0] if version.startswith('Traceback'): # Likely cause is for example forgetting to 'import # os' when using 'os' in setup.py. logger.critical('The setup.py of this package has an error:') print version logger.critical('No version found.') sys.exit(1) return utils.strip_version(version)
def get_setup_py_version(self): if os.path.exists("setup.py"): # First run egg_info, as that may get rid of some warnings # that otherwise end up in the extracted version, like # UserWarnings. system(utils.setup_py("egg_info")) version = system(utils.setup_py("--version")) if version.startswith("Traceback"): # Likely cause is for example forgetting to 'import # os' when using 'os' in setup.py. logger.critical("The setup.py of this package has an error:") print version logger.critical("No version found.") sys.exit(1) return utils.strip_version(version)
def get_python_file_version(self): setup_cfg = pypi.SetupConfig() if not setup_cfg.python_file_with_version(): return lines, encoding = utils.read_text_file( setup_cfg.python_file_with_version()) encoding # noqa, unused variable lines = lines.splitlines() for line in lines: match = UNDERSCORED_VERSION_PATTERN.search(line) if match: logger.debug("Matching __version__ line found: %r", line) line = line.lstrip('__version__').strip() line = line.lstrip('=').strip() line = line.replace('"', '').replace("'", "") return utils.strip_version(line)
def get_python_file_version(self): python_version_file = self.setup_cfg.python_file_with_version() if not python_version_file: return lines, encoding = utils.read_text_file( python_version_file, fallback_encoding=self.fallback_encoding, ) encoding # noqa, unused variable for line in lines: match = UNDERSCORED_VERSION_PATTERN.search(line) if match: logger.debug("Matching __version__ line found: '%s'", line) line = line.lstrip('__version__').strip() line = line.lstrip('=').strip() line = line.replace('"', '').replace("'", "") return utils.strip_version(line)
def get_version_txt_version(self): version_file = self.filefind(['version.txt', 'version']) if version_file: f = open(version_file, 'r') version = f.read() return utils.strip_version(version)
def get_version_txt_version(self): version_file = self.filefind('version.txt') if version_file: f = open(version_file, 'r') version = f.read() return utils.strip_version(version)