Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: remove -Dversion_fallback and introduce .VERSION file
The version script will now first try to read the version from a .VERSION file in the source root. If that file does not exist, it will query git. The .VERSION file is not included in the git repository, it is generated for inclusion in source tarballs. Package maintainers who had any use for -Dversion_fallback may want to create the .VERSION file themselves. Additionally, some git-specific files have been removed from source tarballs.
- Loading branch information
Showing
6 changed files
with
68 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,4 @@ __pycache__ | |
*~ | ||
*-autosave.kra | ||
*.swp | ||
.VERSION |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import os | ||
import sys | ||
import pathlib | ||
import taiseilib.version | ||
import shutil | ||
|
||
|
||
def main(args): | ||
def env_dir_path(v): | ||
try: | ||
s = os.environ[v] | ||
except KeyError: | ||
print("{} is not set".format(v)) | ||
|
||
p = pathlib.Path(s) | ||
assert p.is_dir() | ||
return p | ||
|
||
src_root = env_dir_path('MESON_PROJECT_SOURCE_ROOT') | ||
dist_root = env_dir_path('MESON_PROJECT_DIST_ROOT') | ||
src_version = taiseilib.version.get(rootdir=src_root) | ||
|
||
(dist_root / taiseilib.version.OVERRIDE_FILE_NAME).write_text(src_version.string) | ||
|
||
remove_files = [ | ||
'.dockerignore', | ||
'.gitattributes', | ||
'.gitignore', | ||
'.gitmodules', | ||
'.mailmap', | ||
'checkout', | ||
'pull', | ||
] | ||
|
||
for fname in remove_files: | ||
(dist_root / fname).unlink(fname) | ||
|
||
shutil.rmtree(str(dist_root / '.github')) | ||
|
||
|
||
if __name__ == '__main__': | ||
from taiseilib.common import run_main | ||
run_main(main) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters