-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #106 from bwhmather/freeze-version
Automatically freeze version during release
- Loading branch information
Showing
4 changed files
with
50 additions
and
2 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
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
__pycache__/ | ||
*.egg-info/ | ||
.tox | ||
src/ssort/_version.py |
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,40 @@ | ||
""" | ||
Reads a version string from stdin and writes a python script which exports it | ||
to stdout. | ||
""" | ||
|
||
import argparse | ||
import pathlib | ||
|
||
|
||
def main(): | ||
parser = argparse.ArgumentParser( | ||
description="Hard codes the version number reported by ssort" | ||
) | ||
parser.add_argument( | ||
"-o", | ||
"--output", | ||
type=pathlib.Path, | ||
default=pathlib.Path("src/ssort/_version.py"), | ||
help="Where to write the frozen version number", | ||
) | ||
parser.add_argument( | ||
"version", | ||
type=str, | ||
help="The new version number to write", | ||
) | ||
|
||
args = parser.parse_args() | ||
|
||
output = f"""\"\"\" | ||
Generated by `scripts/freeze_version.py`. Do not edit directly. | ||
\"\"\" | ||
VERSION = {args.version!r} | ||
""" | ||
|
||
args.output.write_text(output) | ||
|
||
|
||
if __name__ == "__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