snakedeploy 0.14.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. snakedeploy/__init__.py +3 -0
  2. snakedeploy/_version.py +561 -0
  3. snakedeploy/client.py +324 -0
  4. snakedeploy/collect_files.py +58 -0
  5. snakedeploy/conda.py +385 -0
  6. snakedeploy/conda_version.py +709 -0
  7. snakedeploy/deploy.py +280 -0
  8. snakedeploy/exceptions.py +44 -0
  9. snakedeploy/logger.py +172 -0
  10. snakedeploy/providers.py +121 -0
  11. snakedeploy/scaffold_plugins/__init__.py +32 -0
  12. snakedeploy/scaffold_plugins/common.py +170 -0
  13. snakedeploy/scaffold_plugins/executor_plugins.py +20 -0
  14. snakedeploy/scaffold_plugins/logger_plugins.py +26 -0
  15. snakedeploy/scaffold_plugins/report_plugins.py +20 -0
  16. snakedeploy/scaffold_plugins/scheduler_plugins.py +20 -0
  17. snakedeploy/scaffold_plugins/software_deployment_plugins.py +20 -0
  18. snakedeploy/scaffold_plugins/storage_plugins.py +20 -0
  19. snakedeploy/snakemake_wrappers.py +150 -0
  20. snakedeploy/templates/plugins/ci.yml.j2 +70 -0
  21. snakedeploy/templates/plugins/conventional_prs.yml.j2 +16 -0
  22. snakedeploy/templates/plugins/executor-plugins/init.py +148 -0
  23. snakedeploy/templates/plugins/executor-plugins/tests.py.j2 +16 -0
  24. snakedeploy/templates/plugins/logger-plugins/init.py +93 -0
  25. snakedeploy/templates/plugins/logger-plugins/tests.py +15 -0
  26. snakedeploy/templates/plugins/release_please.yml.j2 +45 -0
  27. snakedeploy/templates/plugins/report-plugins/init.py +61 -0
  28. snakedeploy/templates/plugins/report-plugins/tests.py +16 -0
  29. snakedeploy/templates/plugins/scheduler-plugins/init.py +89 -0
  30. snakedeploy/templates/plugins/scheduler-plugins/tests.py +20 -0
  31. snakedeploy/templates/plugins/setup.cfg.j2 +7 -0
  32. snakedeploy/templates/plugins/software-deployment-plugins/init.py +187 -0
  33. snakedeploy/templates/plugins/software-deployment-plugins/tests.py +44 -0
  34. snakedeploy/templates/plugins/storage-plugins/init.py +240 -0
  35. snakedeploy/templates/plugins/storage-plugins/tests.py +37 -0
  36. snakedeploy/templates/post-instructions.txt.jinja +9 -0
  37. snakedeploy/templates/use_module.smk.jinja +19 -0
  38. snakedeploy/utils.py +67 -0
  39. snakedeploy-0.14.0.dist-info/METADATA +41 -0
  40. snakedeploy-0.14.0.dist-info/RECORD +43 -0
  41. snakedeploy-0.14.0.dist-info/WHEEL +4 -0
  42. snakedeploy-0.14.0.dist-info/entry_points.txt +2 -0
  43. snakedeploy-0.14.0.dist-info/licenses/LICENSE +328 -0
@@ -0,0 +1,3 @@
1
+ __author__ = "Vanessa Sochat"
2
+ __copyright__ = "Copyright 2020-2021, Vanessa Sochat"
3
+ __license__ = "MPL 2.0"
@@ -0,0 +1,561 @@
1
+ # This file helps to compute a version number in source trees obtained from
2
+ # git-archive tarball (such as those provided by githubs download-from-tag
3
+ # feature). Distribution tarballs (built by setup.py sdist) and build
4
+ # directories (produced by setup.py build) will contain a much shorter file
5
+ # that just contains the computed version number.
6
+
7
+ # This file is released into the public domain. Generated by
8
+ # versioneer-0.19 (https://github.com/python-versioneer/python-versioneer)
9
+
10
+ """Git implementation of _version.py."""
11
+
12
+ import errno
13
+ import os
14
+ import re
15
+ import subprocess
16
+ import sys
17
+
18
+
19
+ def get_keywords():
20
+ """Get the keywords needed to look up the version information."""
21
+ # these strings will be replaced by git during git-archive.
22
+ # setup.py/versioneer.py will grep for the variable names, so they must
23
+ # each be defined on a line of their own. _version.py will just call
24
+ # get_keywords().
25
+ git_refnames = "$Format:%d$"
26
+ git_full = "$Format:%H$"
27
+ git_date = "$Format:%ci$"
28
+ keywords = {"refnames": git_refnames, "full": git_full, "date": git_date}
29
+ return keywords
30
+
31
+
32
+ class VersioneerConfig:
33
+ """Container for Versioneer configuration parameters."""
34
+
35
+
36
+ def get_config():
37
+ """Create, populate and return the VersioneerConfig() object."""
38
+ # these strings are filled in when 'setup.py versioneer' creates
39
+ # _version.py
40
+ cfg = VersioneerConfig()
41
+ cfg.VCS = "git"
42
+ cfg.style = "pep440"
43
+ cfg.tag_prefix = "v"
44
+ cfg.parentdir_prefix = "None"
45
+ cfg.versionfile_source = "snakedeploy/_version.py"
46
+ cfg.verbose = False
47
+ return cfg
48
+
49
+
50
+ class NotThisMethod(Exception):
51
+ """Exception raised if a method is not valid for the current scenario."""
52
+
53
+
54
+ LONG_VERSION_PY = {}
55
+ HANDLERS = {}
56
+
57
+
58
+ def register_vcs_handler(vcs, method): # decorator
59
+ """Create decorator to mark a method as the handler of a VCS."""
60
+
61
+ def decorate(f):
62
+ """Store f in HANDLERS[vcs][method]."""
63
+ if vcs not in HANDLERS:
64
+ HANDLERS[vcs] = {}
65
+ HANDLERS[vcs][method] = f
66
+ return f
67
+
68
+ return decorate
69
+
70
+
71
+ def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False, env=None):
72
+ """Call the given command(s)."""
73
+ assert isinstance(commands, list)
74
+ p = None
75
+ for c in commands:
76
+ try:
77
+ dispcmd = str([c] + args)
78
+ # remember shell=False, so use git.cmd on windows, not just git
79
+ p = subprocess.Popen(
80
+ [c] + args,
81
+ cwd=cwd,
82
+ env=env,
83
+ stdout=subprocess.PIPE,
84
+ stderr=(subprocess.PIPE if hide_stderr else None),
85
+ )
86
+ break
87
+ except EnvironmentError:
88
+ e = sys.exc_info()[1]
89
+ if e.errno == errno.ENOENT:
90
+ continue
91
+ if verbose:
92
+ print("unable to run %s" % dispcmd)
93
+ print(e)
94
+ return None, None
95
+ else:
96
+ if verbose:
97
+ print("unable to find command, tried %s" % (commands,))
98
+ return None, None
99
+ stdout = p.communicate()[0].strip().decode()
100
+ if p.returncode != 0:
101
+ if verbose:
102
+ print("unable to run %s (error)" % dispcmd)
103
+ print("stdout was %s" % stdout)
104
+ return None, p.returncode
105
+ return stdout, p.returncode
106
+
107
+
108
+ def versions_from_parentdir(parentdir_prefix, root, verbose):
109
+ """Try to determine the version from the parent directory name.
110
+
111
+ Source tarballs conventionally unpack into a directory that includes both
112
+ the project name and a version string. We will also support searching up
113
+ two directory levels for an appropriately named parent directory
114
+ """
115
+ rootdirs = []
116
+
117
+ for i in range(3):
118
+ dirname = os.path.basename(root)
119
+ if dirname.startswith(parentdir_prefix):
120
+ return {
121
+ "version": dirname[len(parentdir_prefix) :],
122
+ "full-revisionid": None,
123
+ "dirty": False,
124
+ "error": None,
125
+ "date": None,
126
+ }
127
+ else:
128
+ rootdirs.append(root)
129
+ root = os.path.dirname(root) # up a level
130
+
131
+ if verbose:
132
+ print(
133
+ "Tried directories %s but none started with prefix %s"
134
+ % (str(rootdirs), parentdir_prefix)
135
+ )
136
+ raise NotThisMethod("rootdir doesn't start with parentdir_prefix")
137
+
138
+
139
+ @register_vcs_handler("git", "get_keywords")
140
+ def git_get_keywords(versionfile_abs):
141
+ """Extract version information from the given file."""
142
+ # the code embedded in _version.py can just fetch the value of these
143
+ # keywords. When used from setup.py, we don't want to import _version.py,
144
+ # so we do it with a regexp instead. This function is not used from
145
+ # _version.py.
146
+ keywords = {}
147
+ try:
148
+ f = open(versionfile_abs, "r")
149
+ for line in f.readlines():
150
+ if line.strip().startswith("git_refnames ="):
151
+ mo = re.search(r'=\s*"(.*)"', line)
152
+ if mo:
153
+ keywords["refnames"] = mo.group(1)
154
+ if line.strip().startswith("git_full ="):
155
+ mo = re.search(r'=\s*"(.*)"', line)
156
+ if mo:
157
+ keywords["full"] = mo.group(1)
158
+ if line.strip().startswith("git_date ="):
159
+ mo = re.search(r'=\s*"(.*)"', line)
160
+ if mo:
161
+ keywords["date"] = mo.group(1)
162
+ f.close()
163
+ except EnvironmentError:
164
+ pass
165
+ return keywords
166
+
167
+
168
+ @register_vcs_handler("git", "keywords")
169
+ def git_versions_from_keywords(keywords, tag_prefix, verbose):
170
+ """Get version information from git keywords."""
171
+ if not keywords:
172
+ raise NotThisMethod("no keywords at all, weird")
173
+ date = keywords.get("date")
174
+ if date is not None:
175
+ # Use only the last line. Previous lines may contain GPG signature
176
+ # information.
177
+ date = date.splitlines()[-1]
178
+
179
+ # git-2.2.0 added "%cI", which expands to an ISO-8601 -compliant
180
+ # datestamp. However we prefer "%ci" (which expands to an "ISO-8601
181
+ # -like" string, which we must then edit to make compliant), because
182
+ # it's been around since git-1.5.3, and it's too difficult to
183
+ # discover which version we're using, or to work around using an
184
+ # older one.
185
+ date = date.strip().replace(" ", "T", 1).replace(" ", "", 1)
186
+ refnames = keywords["refnames"].strip()
187
+ if refnames.startswith("$Format"):
188
+ if verbose:
189
+ print("keywords are unexpanded, not using")
190
+ raise NotThisMethod("unexpanded keywords, not a git-archive tarball")
191
+ refs = set([r.strip() for r in refnames.strip("()").split(",")])
192
+ # starting in git-1.8.3, tags are listed as "tag: foo-1.0" instead of
193
+ # just "foo-1.0". If we see a "tag: " prefix, prefer those.
194
+ TAG = "tag: "
195
+ tags = set([r[len(TAG) :] for r in refs if r.startswith(TAG)])
196
+ if not tags:
197
+ # Either we're using git < 1.8.3, or there really are no tags. We use
198
+ # a heuristic: assume all version tags have a digit. The old git %d
199
+ # expansion behaves like git log --decorate=short and strips out the
200
+ # refs/heads/ and refs/tags/ prefixes that would let us distinguish
201
+ # between branches and tags. By ignoring refnames without digits, we
202
+ # filter out many common branch names like "release" and
203
+ # "stabilization", as well as "HEAD" and "master".
204
+ tags = set([r for r in refs if re.search(r"\d", r)])
205
+ if verbose:
206
+ print("discarding '%s', no digits" % ",".join(refs - tags))
207
+ if verbose:
208
+ print("likely tags: %s" % ",".join(sorted(tags)))
209
+ for ref in sorted(tags):
210
+ # sorting will prefer e.g. "2.0" over "2.0rc1"
211
+ if ref.startswith(tag_prefix):
212
+ r = ref[len(tag_prefix) :]
213
+ if verbose:
214
+ print("picking %s" % r)
215
+ return {
216
+ "version": r,
217
+ "full-revisionid": keywords["full"].strip(),
218
+ "dirty": False,
219
+ "error": None,
220
+ "date": date,
221
+ }
222
+ # no suitable tags, so version is "0+unknown", but full hex is still there
223
+ if verbose:
224
+ print("no suitable tags, using unknown + full revision id")
225
+ return {
226
+ "version": "0+unknown",
227
+ "full-revisionid": keywords["full"].strip(),
228
+ "dirty": False,
229
+ "error": "no suitable tags",
230
+ "date": None,
231
+ }
232
+
233
+
234
+ @register_vcs_handler("git", "pieces_from_vcs")
235
+ def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command):
236
+ """Get version from 'git describe' in the root of the source tree.
237
+
238
+ This only gets called if the git-archive 'subst' keywords were *not*
239
+ expanded, and _version.py hasn't already been rewritten with a short
240
+ version string, meaning we're inside a checked out source tree.
241
+ """
242
+ GITS = ["git"]
243
+ if sys.platform == "win32":
244
+ GITS = ["git.cmd", "git.exe"]
245
+
246
+ out, rc = run_command(GITS, ["rev-parse", "--git-dir"], cwd=root, hide_stderr=True)
247
+ if rc != 0:
248
+ if verbose:
249
+ print("Directory %s not under git control" % root)
250
+ raise NotThisMethod("'git rev-parse --git-dir' returned error")
251
+
252
+ # if there is a tag matching tag_prefix, this yields TAG-NUM-gHEX[-dirty]
253
+ # if there isn't one, this yields HEX[-dirty] (no NUM)
254
+ describe_out, rc = run_command(
255
+ GITS,
256
+ [
257
+ "describe",
258
+ "--tags",
259
+ "--dirty",
260
+ "--always",
261
+ "--long",
262
+ "--match",
263
+ "%s*" % tag_prefix,
264
+ ],
265
+ cwd=root,
266
+ )
267
+ # --long was added in git-1.5.5
268
+ if describe_out is None:
269
+ raise NotThisMethod("'git describe' failed")
270
+ describe_out = describe_out.strip()
271
+ full_out, rc = run_command(GITS, ["rev-parse", "HEAD"], cwd=root)
272
+ if full_out is None:
273
+ raise NotThisMethod("'git rev-parse' failed")
274
+ full_out = full_out.strip()
275
+
276
+ pieces = {}
277
+ pieces["long"] = full_out
278
+ pieces["short"] = full_out[:7] # maybe improved later
279
+ pieces["error"] = None
280
+
281
+ # parse describe_out. It will be like TAG-NUM-gHEX[-dirty] or HEX[-dirty]
282
+ # TAG might have hyphens.
283
+ git_describe = describe_out
284
+
285
+ # look for -dirty suffix
286
+ dirty = git_describe.endswith("-dirty")
287
+ pieces["dirty"] = dirty
288
+ if dirty:
289
+ git_describe = git_describe[: git_describe.rindex("-dirty")]
290
+
291
+ # now we have TAG-NUM-gHEX or HEX
292
+
293
+ if "-" in git_describe:
294
+ # TAG-NUM-gHEX
295
+ mo = re.search(r"^(.+)-(\d+)-g([0-9a-f]+)$", git_describe)
296
+ if not mo:
297
+ # unparseable. Maybe git-describe is misbehaving?
298
+ pieces["error"] = "unable to parse git-describe output: '%s'" % describe_out
299
+ return pieces
300
+
301
+ # tag
302
+ full_tag = mo.group(1)
303
+ if not full_tag.startswith(tag_prefix):
304
+ if verbose:
305
+ fmt = "tag '%s' doesn't start with prefix '%s'"
306
+ print(fmt % (full_tag, tag_prefix))
307
+ pieces["error"] = "tag '%s' doesn't start with prefix '%s'" % (
308
+ full_tag,
309
+ tag_prefix,
310
+ )
311
+ return pieces
312
+ pieces["closest-tag"] = full_tag[len(tag_prefix) :]
313
+
314
+ # distance: number of commits since tag
315
+ pieces["distance"] = int(mo.group(2))
316
+
317
+ # commit: short hex revision ID
318
+ pieces["short"] = mo.group(3)
319
+
320
+ else:
321
+ # HEX: no tags
322
+ pieces["closest-tag"] = None
323
+ count_out, rc = run_command(GITS, ["rev-list", "HEAD", "--count"], cwd=root)
324
+ pieces["distance"] = int(count_out) # total number of commits
325
+
326
+ # commit date: see ISO-8601 comment in git_versions_from_keywords()
327
+ date = run_command(GITS, ["show", "-s", "--format=%ci", "HEAD"], cwd=root)[
328
+ 0
329
+ ].strip()
330
+ # Use only the last line. Previous lines may contain GPG signature
331
+ # information.
332
+ date = date.splitlines()[-1]
333
+ pieces["date"] = date.strip().replace(" ", "T", 1).replace(" ", "", 1)
334
+
335
+ return pieces
336
+
337
+
338
+ def plus_or_dot(pieces):
339
+ """Return a + if we don't already have one, else return a ."""
340
+ if "+" in pieces.get("closest-tag", ""):
341
+ return "."
342
+ return "+"
343
+
344
+
345
+ def render_pep440(pieces):
346
+ """Build up version string, with post-release "local version identifier".
347
+
348
+ Our goal: TAG[+DISTANCE.gHEX[.dirty]] . Note that if you
349
+ get a tagged build and then dirty it, you'll get TAG+0.gHEX.dirty
350
+
351
+ Exceptions:
352
+ 1: no tags. git_describe was just HEX. 0+untagged.DISTANCE.gHEX[.dirty]
353
+ """
354
+ if pieces["closest-tag"]:
355
+ rendered = pieces["closest-tag"]
356
+ if pieces["distance"] or pieces["dirty"]:
357
+ rendered += plus_or_dot(pieces)
358
+ rendered += "%d.g%s" % (pieces["distance"], pieces["short"])
359
+ if pieces["dirty"]:
360
+ rendered += ".dirty"
361
+ else:
362
+ # exception #1
363
+ rendered = "0+untagged.%d.g%s" % (pieces["distance"], pieces["short"])
364
+ if pieces["dirty"]:
365
+ rendered += ".dirty"
366
+ return rendered
367
+
368
+
369
+ def render_pep440_pre(pieces):
370
+ """TAG[.post0.devDISTANCE] -- No -dirty.
371
+
372
+ Exceptions:
373
+ 1: no tags. 0.post0.devDISTANCE
374
+ """
375
+ if pieces["closest-tag"]:
376
+ rendered = pieces["closest-tag"]
377
+ if pieces["distance"]:
378
+ rendered += ".post0.dev%d" % pieces["distance"]
379
+ else:
380
+ # exception #1
381
+ rendered = "0.post0.dev%d" % pieces["distance"]
382
+ return rendered
383
+
384
+
385
+ def render_pep440_post(pieces):
386
+ """TAG[.postDISTANCE[.dev0]+gHEX] .
387
+
388
+ The ".dev0" means dirty. Note that .dev0 sorts backwards
389
+ (a dirty tree will appear "older" than the corresponding clean one),
390
+ but you shouldn't be releasing software with -dirty anyways.
391
+
392
+ Exceptions:
393
+ 1: no tags. 0.postDISTANCE[.dev0]
394
+ """
395
+ if pieces["closest-tag"]:
396
+ rendered = pieces["closest-tag"]
397
+ if pieces["distance"] or pieces["dirty"]:
398
+ rendered += ".post%d" % pieces["distance"]
399
+ if pieces["dirty"]:
400
+ rendered += ".dev0"
401
+ rendered += plus_or_dot(pieces)
402
+ rendered += "g%s" % pieces["short"]
403
+ else:
404
+ # exception #1
405
+ rendered = "0.post%d" % pieces["distance"]
406
+ if pieces["dirty"]:
407
+ rendered += ".dev0"
408
+ rendered += "+g%s" % pieces["short"]
409
+ return rendered
410
+
411
+
412
+ def render_pep440_old(pieces):
413
+ """TAG[.postDISTANCE[.dev0]] .
414
+
415
+ The ".dev0" means dirty.
416
+
417
+ Exceptions:
418
+ 1: no tags. 0.postDISTANCE[.dev0]
419
+ """
420
+ if pieces["closest-tag"]:
421
+ rendered = pieces["closest-tag"]
422
+ if pieces["distance"] or pieces["dirty"]:
423
+ rendered += ".post%d" % pieces["distance"]
424
+ if pieces["dirty"]:
425
+ rendered += ".dev0"
426
+ else:
427
+ # exception #1
428
+ rendered = "0.post%d" % pieces["distance"]
429
+ if pieces["dirty"]:
430
+ rendered += ".dev0"
431
+ return rendered
432
+
433
+
434
+ def render_git_describe(pieces):
435
+ """TAG[-DISTANCE-gHEX][-dirty].
436
+
437
+ Like 'git describe --tags --dirty --always'.
438
+
439
+ Exceptions:
440
+ 1: no tags. HEX[-dirty] (note: no 'g' prefix)
441
+ """
442
+ if pieces["closest-tag"]:
443
+ rendered = pieces["closest-tag"]
444
+ if pieces["distance"]:
445
+ rendered += "-%d-g%s" % (pieces["distance"], pieces["short"])
446
+ else:
447
+ # exception #1
448
+ rendered = pieces["short"]
449
+ if pieces["dirty"]:
450
+ rendered += "-dirty"
451
+ return rendered
452
+
453
+
454
+ def render_git_describe_long(pieces):
455
+ """TAG-DISTANCE-gHEX[-dirty].
456
+
457
+ Like 'git describe --tags --dirty --always -long'.
458
+ The distance/hash is unconditional.
459
+
460
+ Exceptions:
461
+ 1: no tags. HEX[-dirty] (note: no 'g' prefix)
462
+ """
463
+ if pieces["closest-tag"]:
464
+ rendered = pieces["closest-tag"]
465
+ rendered += "-%d-g%s" % (pieces["distance"], pieces["short"])
466
+ else:
467
+ # exception #1
468
+ rendered = pieces["short"]
469
+ if pieces["dirty"]:
470
+ rendered += "-dirty"
471
+ return rendered
472
+
473
+
474
+ def render(pieces, style):
475
+ """Render the given version pieces into the requested style."""
476
+ if pieces["error"]:
477
+ return {
478
+ "version": "unknown",
479
+ "full-revisionid": pieces.get("long"),
480
+ "dirty": None,
481
+ "error": pieces["error"],
482
+ "date": None,
483
+ }
484
+
485
+ if not style or style == "default":
486
+ style = "pep440" # the default
487
+
488
+ if style == "pep440":
489
+ rendered = render_pep440(pieces)
490
+ elif style == "pep440-pre":
491
+ rendered = render_pep440_pre(pieces)
492
+ elif style == "pep440-post":
493
+ rendered = render_pep440_post(pieces)
494
+ elif style == "pep440-old":
495
+ rendered = render_pep440_old(pieces)
496
+ elif style == "git-describe":
497
+ rendered = render_git_describe(pieces)
498
+ elif style == "git-describe-long":
499
+ rendered = render_git_describe_long(pieces)
500
+ else:
501
+ raise ValueError("unknown style '%s'" % style)
502
+
503
+ return {
504
+ "version": rendered,
505
+ "full-revisionid": pieces["long"],
506
+ "dirty": pieces["dirty"],
507
+ "error": None,
508
+ "date": pieces.get("date"),
509
+ }
510
+
511
+
512
+ def get_versions():
513
+ """Get version information or return default if unable to do so."""
514
+ # I am in _version.py, which lives at ROOT/VERSIONFILE_SOURCE. If we have
515
+ # __file__, we can work backwards from there to the root. Some
516
+ # py2exe/bbfreeze/non-CPython implementations don't do __file__, in which
517
+ # case we can only use expanded keywords.
518
+
519
+ cfg = get_config()
520
+ verbose = cfg.verbose
521
+
522
+ try:
523
+ return git_versions_from_keywords(get_keywords(), cfg.tag_prefix, verbose)
524
+ except NotThisMethod:
525
+ pass
526
+
527
+ try:
528
+ root = os.path.realpath(__file__)
529
+ # versionfile_source is the relative path from the top of the source
530
+ # tree (where the .git directory might live) to this file. Invert
531
+ # this to find the root from __file__.
532
+ for i in cfg.versionfile_source.split("/"):
533
+ root = os.path.dirname(root)
534
+ except NameError:
535
+ return {
536
+ "version": "0+unknown",
537
+ "full-revisionid": None,
538
+ "dirty": None,
539
+ "error": "unable to find root of source tree",
540
+ "date": None,
541
+ }
542
+
543
+ try:
544
+ pieces = git_pieces_from_vcs(cfg.tag_prefix, root, verbose)
545
+ return render(pieces, cfg.style)
546
+ except NotThisMethod:
547
+ pass
548
+
549
+ try:
550
+ if cfg.parentdir_prefix:
551
+ return versions_from_parentdir(cfg.parentdir_prefix, root, verbose)
552
+ except NotThisMethod:
553
+ pass
554
+
555
+ return {
556
+ "version": "0+unknown",
557
+ "full-revisionid": None,
558
+ "dirty": None,
559
+ "error": "unable to compute version",
560
+ "date": None,
561
+ }