def html(): """Build/make the HTML documentation. """ # Rebuild the static images. if util.yes("Do you want to rebuild the static images (y/n)?"): static() # Update the download link. try: commit = git('rev-list', '--tags', '--max-count=1').stdout.rstrip() lastversion = git.describe('--tags', commit).stdout.rstrip() # This is simpler but doesn't always return the latest tag: # lastversion = git.describe('--tag', abbrev=0).stdout.rstrip() except ErrorReturnCode_128: pass # No tags recorded; leave download link as is else: date = git.log('-1', lastversion, date='short', format='%ad').stdout[8:18] rpls = [ (r'(ModelicaRes)-.*(\.tar)', r'\1-%s\2' % lastversion[1:]), (r'(Latest version<br>\().*(\)</a>)', r'\1%s, %s\2' % (lastversion, date)), ] util.replace('_templates/download.html', rpls) # Build the documentation. make_dirs() sphinx = sphinx_build.bake(b='html', d='build/doctrees') print((sphinx('.', BUILD_DIR))) # Spellcheck. if util.yes("Do you want to spellcheck the HTML documentation (y/n)?"): spellcheck()
def html(): """Build/make the HTML documentation. """ # Rebuild the static images. if util.yes("Do you want to rebuild the static images (y/n)?"): static() # Update the download link. try: commit = git('rev-list', '--tags', '--max-count=1').stdout.rstrip() lastversion = git.describe('--tags', commit).stdout.rstrip() # This is simpler but doesn't always return the latest tag: # lastversion = git.describe('--tag', abbrev=0).stdout.rstrip() except ErrorReturnCode_128: pass # No tags recorded; leave download link as is else: date = git.log('-1', lastversion, date='short', format='%ad').stdout[8:18] rpls = [(r'(ModelicaRes)-.*(\.tar)', r'\1-%s\2' % lastversion[1:]), (r'(Latest version<br>\().*(\)</a>)', r'\1%s, %s\2' % (lastversion, date)), ] util.replace('_templates/download.html', rpls) # Build the documentation. make_dirs() sphinx = sphinx_build.bake(b='html', d='build/doctrees') print(sphinx('.', BUILD_DIR)) # Spellcheck. if util.yes("Do you want to spellcheck the HTML documentation (y/n)?"): spellcheck()
def main(): print('fetching version') version_file = Path('VERSION') version = str(git.describe('--tags')).strip() short_version = version.rsplit('-', maxsplit=1)[0] print('new version: {} ({})'.format(version, short_version)) with version_file.open('w') as f: f.write(version) print('VERSION file created') export_dir = Path(exports_dir).resolve() / '-'.join(game_name) export_dir.mkdir(exist_ok=True) export_dir /= version export_dir.mkdir(exist_ok=True) print('export directory: {}'.format(export_dir)) for platform, short_platform in platforms: platform_export_dir = export_dir / '-'.join( game_name + [short_platform, short_version]) platform_export_dir.mkdir(exist_ok=True) export_path = platform_export_dir / '-'.join(game_name) if short_platform == 'windows': export_path = export_path.with_suffix('.exe') print('exporting {} to {}'.format(platform, export_path)) godot('--export', platform, export_path) license_file = Path(__file__).parent / 'LICENSE' copyfile(license_file, Path(platform_export_dir) / 'LICENSE') if short_platform == 'html5': export_path.rename( export_path.with_name('index').with_suffix('.html')) if short_platform == 'windows': wine(rc_edit, export_path, '--set-icon', 'icon.ico') wine(rc_edit, export_path, '--set-file-version', short_version[1:]) wine(rc_edit, export_path, '--set-product-version', short_version[1:]) wine(rc_edit, export_path, '--set-version-string', 'CompanyName', '-'.join(game_name)) wine(rc_edit, export_path, '--set-version-string', 'ProductName', '-'.join(game_name)) wine(rc_edit, export_path, '--set-version-string', 'FileDescription', '-'.join(game_name)) wine(rc_edit, export_path, '--set-version-string', 'OriginalFilename', export_path.name) wine(rc_edit, export_path, '--set-version-string', 'LegalCopyright', copyright_text) archive_path = export_dir / ( '-'.join(game_name + [short_platform, short_version]) + '.zip') print('archiving to {}'.format(archive_path)) make_archive(archive_path.with_suffix(''), 'zip', platform_export_dir) with ZipFile(archive_path, 'r') as f: print(f.namelist()) version_file.unlink()
def main(): version_file = Path('VERSION') version = str(git.describe('--tags')).strip() short_version = version.rsplit('-', maxsplit=1)[0] print(f'Version: {version} ({short_version})') with version_file.open('w') as f: f.write(version) print('VERSION file created') global export_dir export_dir = export_dir / version export_dir.mkdir(exist_ok=True) print(f'Export directory: {export_dir}') for platform, short_platform in platforms: file_name = f'{game_file_name}-{short_platform}-{short_version}' platform_export_dir = export_dir / file_name platform_export_dir.mkdir(exist_ok=True) export_path = platform_export_dir / game_file_name if 'windows' in short_platform: export_path = export_path.parent / (export_path.name + '.exe') print(f'Exporting {platform} to {export_path}') godot('--export', platform, export_path) license_file = Path(__file__).parent / 'LICENSE' copyfile(license_file, Path(platform_export_dir) / 'LICENSE') if 'windows' in short_platform: _, _, rcedit = whereis('rcedit-x64.exe' if '64' in short_platform else 'rcedit-x86.exe').partition(':') rcedit = rcedit.strip() print(f'Using rcedit at {rcedit}') commands = [ ['--set-icon', windows_icon], ['--set-file-version', short_version[1:]], ['--set-product-version', short_version[1:]], ['--set-version-string', 'CompanyName', game_pretty_name], ['--set-version-string', 'ProductName', game_pretty_name], ['--set-version-string', 'Info', info], ['--set-version-string', 'FileDescription', game_pretty_name], ['--set-version-string', 'OriginalFilename', export_path.name], ['--set-version-string', 'LegalCopyright', legal_copyright] ] for command in commands: wine(rcedit, export_path, *command) archive_path = export_dir / (file_name + '.zip') print(f'Archiving to {archive_path}') make_archive(archive_path.with_suffix(''), 'zip', platform_export_dir) with ZipFile(archive_path, 'r') as f: print('Files in archive:', f.namelist()) version_file.unlink()
def build(): """Build the code to prepare for release. """ # Check that long-description.txt is a valid ReST file (otherwise, the PyPI # page won't display correctly). readme = 'doc/long-description.txt' error_start = 'Docutils System Messages\n' with open(readme, 'r') as rstfile: parsed = publish_string(rstfile.read()) if error_start in parsed: print("Errors in " + readme) util.delayed_exit() # Run other setup tests. if setup.check('-rms').exit_code: print("The setup.py check failed.") util.delayed_exit() # Get the new version number. commit = git('rev-list', '--tags', '--max-count=1').stdout.rstrip() lastversion = git.describe('--tags', commit).stdout.rstrip().lstrip('v') # This is simpler but doesn't always return the latest tag: # lastversion = git.describe('--tag', abbrev=0).stdout.rstrip() version = raw_input("Enter the version number (last was %s): " % lastversion) # Tag the version (will prompt for message). git.tag('-af', 'v' + version) # Update the version number. # In CHANGES.txt: date = strftime('%Y-%-m-%-d') rpls = [(r'TBD.*( -- Updates:)', r'v{v}_ ({d})\1'.format(v=version, d=date)), (r'v%s_ \(.+\)( -- Updates:)' % version, r'v{v}_ ({d})\1'.format(v=version, d=date)), (r'(.. _)vx\.x\.x(.+)vx\.x\.x(\.zip)', r'\1v{v}\2v{v}\3'.format(v=version))] util.replace('CHANGES.txt', rpls) # Note that versioneer automatically handles the version number in # natu/__init__.py. # Build, install, and test the code. setup.build() os.system('sudo python setup.py install') os.system('sudo python3 setup.py install') os.system('python setup.py test') os.system('python3 setup.py test') # Create a tarball and zip (*.tar.gz and *.zip). setup.sdist(formats='gztar,zip')
def version(self): ''' retruns the verison of the code from github :rtype: the git tags ''' return str(git.describe("--tags"))[:-1]
def add_git_version(s): try: return ' ' + git.describe('--tags').strip() except ErrorReturnCode: pass
def version(self): return str(git.describe("--tags"))[:-1]
def add_git_version(s): try: return ' '+git.describe('--tags').strip() except ErrorReturnCode: pass
def show_version(): git_hash = git.describe('--always').lstrip().rstrip() return '%s[%s]' % (VERSION_NUM, git_hash)
def main(): git_hash = git.describe('--always').lstrip().rstrip() version = '%s[%s]' % (VERSION_NUM, git_hash) print(VERSION_MODULE_TEMPLATE.format(version_string=version))