MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / generate

Function generate

tensorflow/tools/git/gen_git_source.py:224–266  ·  view source on GitHub ↗

Generate version_info.cc as given `destination_file`. Args: arglist: should be a sequence that contains spec, head_symlink, ref_symlink, destination_file. `destination_file` is the filename where version_info.cc will be written `spec` is a filename where the file contains a

(arglist, git_tag_override=None)

Source from the content-addressed store, hash-verified

222
223
224def generate(arglist, git_tag_override=None):
225 """Generate version_info.cc as given `destination_file`.
226
227 Args:
228 arglist: should be a sequence that contains
229 spec, head_symlink, ref_symlink, destination_file.
230
231 `destination_file` is the filename where version_info.cc will be written
232
233 `spec` is a filename where the file contains a JSON dictionary
234 'git' bool that is true if the source is in a git repo
235 'path' base path of the source code
236 'branch' the name of the ref specification of the current branch/tag
237
238 `head_symlink` is a filename to HEAD that is cross-referenced against
239 what is contained in the json branch designation.
240
241 `ref_symlink` is unused in this script but passed, because the build
242 system uses that file to detect when commits happen.
243
244 git_tag_override: Override the value for the git tag. This is useful for
245 releases where we want to build the release before the git tag is
246 created.
247
248 Raises:
249 RuntimeError: If ./configure needs to be run, RuntimeError will be raised.
250 """
251
252 # unused ref_symlink arg
253 spec, head_symlink, _, dest_file = arglist
254 data = json.load(open(spec))
255 git_version = None
256 if not data["git"]:
257 git_version = b"unknown"
258 else:
259 old_branch = data["branch"]
260 new_branch = parse_branch_ref(head_symlink)
261 if new_branch != old_branch:
262 raise RuntimeError(
263 "Run ./configure again, branch was '%s' but is now '%s'" %
264 (old_branch, new_branch))
265 git_version = get_git_version(data["path"], git_tag_override)
266 write_version_info(dest_file, git_version)
267
268
269def raw_generate(output_file, source_dir, git_tag_override=None):

Callers 9

gen_git_source.pyFile · 0.70
FillRandomFunction · 0.50
FillRandomFunction · 0.50
RandomDimsMethod · 0.50
XLA_TEST_FFunction · 0.50
GenerateIndicesFunction · 0.50
NewSessionGroupMethod · 0.50
ParseVisibleDeviceListFunction · 0.50
gpu_device.ccFile · 0.50

Calls 4

parse_branch_refFunction · 0.85
get_git_versionFunction · 0.85
write_version_infoFunction · 0.85
loadMethod · 0.45

Tested by 4

FillRandomFunction · 0.40
FillRandomFunction · 0.40
RandomDimsMethod · 0.40
XLA_TEST_FFunction · 0.40