| @@ 930-951 (lines=22) @@ | ||
| 927 | ''' |
|
| 928 | ||
| 929 | ||
| 930 | @register_vcs_handler("git", "get_keywords") |
|
| 931 | def git_get_keywords(versionfile_abs): |
|
| 932 | # the code embedded in _version.py can just fetch the value of these |
|
| 933 | # keywords. When used from setup.py, we don't want to import _version.py, |
|
| 934 | # so we do it with a regexp instead. This function is not used from |
|
| 935 | # _version.py. |
|
| 936 | keywords = {} |
|
| 937 | try: |
|
| 938 | f = open(versionfile_abs, "r") |
|
| 939 | for line in f.readlines(): |
|
| 940 | if line.strip().startswith("git_refnames ="): |
|
| 941 | mo = re.search(r'=\s*"(.*)"', line) |
|
| 942 | if mo: |
|
| 943 | keywords["refnames"] = mo.group(1) |
|
| 944 | if line.strip().startswith("git_full ="): |
|
| 945 | mo = re.search(r'=\s*"(.*)"', line) |
|
| 946 | if mo: |
|
| 947 | keywords["full"] = mo.group(1) |
|
| 948 | f.close() |
|
| 949 | except EnvironmentError: |
|
| 950 | pass |
|
| 951 | return keywords |
|
| 952 | ||
| 953 | ||
| 954 | @register_vcs_handler("git", "keywords") |
|
| @@ 110-131 (lines=22) @@ | ||
| 107 | "dirty": False, "error": None} |
|
| 108 | ||
| 109 | ||
| 110 | @register_vcs_handler("git", "get_keywords") |
|
| 111 | def git_get_keywords(versionfile_abs): |
|
| 112 | # the code embedded in _version.py can just fetch the value of these |
|
| 113 | # keywords. When used from setup.py, we don't want to import _version.py, |
|
| 114 | # so we do it with a regexp instead. This function is not used from |
|
| 115 | # _version.py. |
|
| 116 | keywords = {} |
|
| 117 | try: |
|
| 118 | f = open(versionfile_abs, "r") |
|
| 119 | for line in f.readlines(): |
|
| 120 | if line.strip().startswith("git_refnames ="): |
|
| 121 | mo = re.search(r'=\s*"(.*)"', line) |
|
| 122 | if mo: |
|
| 123 | keywords["refnames"] = mo.group(1) |
|
| 124 | if line.strip().startswith("git_full ="): |
|
| 125 | mo = re.search(r'=\s*"(.*)"', line) |
|
| 126 | if mo: |
|
| 127 | keywords["full"] = mo.group(1) |
|
| 128 | f.close() |
|
| 129 | except EnvironmentError: |
|
| 130 | pass |
|
| 131 | return keywords |
|
| 132 | ||
| 133 | ||
| 134 | @register_vcs_handler("git", "keywords") |
|