-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BLD: Add meson build scripts #49114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
BLD: Add meson build scripts #49114
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,33 @@ | ||
import argparse | ||
import os | ||
|
||
from Cython import Tempita | ||
|
||
|
||
def process_tempita(pxifile, outfile): | ||
with open(pxifile) as f: | ||
tmpl = f.read() | ||
pyxcontent = Tempita.sub(tmpl) | ||
|
||
with open(outfile, "w") as f: | ||
f.write(pyxcontent) | ||
|
||
|
||
def main(): | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument("infile", type=str, help="Path to the input file") | ||
parser.add_argument("-o", "--outdir", type=str, help="Path to the output directory") | ||
args = parser.parse_args() | ||
|
||
if not args.infile.endswith(".in"): | ||
raise ValueError(f"Unexpected extension: {args.infile}") | ||
|
||
outdir_abs = os.path.join(os.getcwd(), args.outdir) | ||
outfile = os.path.join( | ||
outdir_abs, os.path.splitext(os.path.split(args.infile)[1])[0] | ||
) | ||
|
||
process_tempita(args.infile, outfile) | ||
|
||
|
||
main() |
This file contains hidden or 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,34 @@ | ||
import argparse | ||
import os | ||
|
||
import versioneer | ||
|
||
|
||
def write_version_info(path): | ||
if os.environ.get("MESON_DIST_ROOT"): | ||
# raise ValueError("dist root is", os.environ.get("MESON_DIST_ROOT")) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you could remove in a follow up that would be great |
||
path = os.path.join(os.environ.get("MESON_DIST_ROOT"), path) | ||
with open(path, "w") as file: | ||
file.write(f'__version__="{versioneer.get_version()}"\n') | ||
file.write( | ||
f'__git_version__="{versioneer.get_versions()["full-revisionid"]}"\n' | ||
) | ||
|
||
|
||
def main(): | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument( | ||
"-o", "--outfile", type=str, help="Path to write version info to" | ||
) | ||
args = parser.parse_args() | ||
|
||
if not args.outfile.endswith(".py"): | ||
raise ValueError( | ||
f"Output file must be a Python file. " | ||
f"Got: {args.outfile} as filename instead" | ||
) | ||
|
||
write_version_info(args.outfile) | ||
|
||
|
||
main() |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this won't be our vendored versioneer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops. I forgot to update this when I moved it into scripts, will fix it in my next PR.
Unfortunately, I don't think we are able to use non-vendored versioneer.