1
0
Fork 0
mirror of synced 2024-05-01 19:23:24 +12:00
FiraCode/script/common.py
2021-11-12 13:30:20 +00:00

17 lines
464 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#! /usr/bin/env python3
import argparse, os, re, subprocess
root = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
def version():
parser = argparse.ArgumentParser()
parser.add_argument('--version')
(args, _) = parser.parse_known_args()
if args.version:
return args.version
ref = os.getenv('GITHUB_REF')
if ref and ref.startswith('refs/tags/'):
return ref[len('refs/tags/'):]
raise Exception("Cant identify version")