Skip to content

Commit a081fad

Browse files
committed
Write snapshot by default to rosdistro_snapshot.yaml and load it via vinca.yaml file
1 parent 8a559c7 commit a081fad

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

vinca/main.py

+4-12
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,6 @@ def parse_command_line(argv):
126126
default=None,
127127
help="The conda platform to check existing recipes for.",
128128
)
129-
parser.add_argument(
130-
"-z",
131-
"--snapshot",
132-
dest="snapshot",
133-
default=None,
134-
help="The version snapshot file (default: None)."
135-
)
136129
arguments = parser.parse_args(argv[1:])
137130
global selected_platform
138131
config.parsed_args = arguments
@@ -226,12 +219,12 @@ def read_vinca_yaml(filepath):
226219
return vinca_conf
227220

228221

229-
def read_snapshot(filepath):
230-
if not filepath:
222+
def read_snapshot(vinca_conf):
223+
if not "rosdistro_snapshot" in vinca_conf:
231224
return None
232225

233226
yaml = ruamel.yaml.YAML()
234-
snapshot = yaml.load(open(filepath, "r"))
227+
snapshot = yaml.load(open(vinca_conf["rosdistro_snapshot"], "r"))
235228
return snapshot
236229

237230

@@ -868,8 +861,7 @@ def main():
868861
base_dir = os.path.abspath(arguments.dir)
869862
vinca_yaml = os.path.join(base_dir, "vinca.yaml")
870863
vinca_conf = read_vinca_yaml(vinca_yaml)
871-
872-
snapshot = read_snapshot(arguments.snapshot)
864+
snapshot = read_snapshot(vinca_conf)
873865

874866
from .template import generate_bld_ament_cmake
875867
from .template import generate_bld_ament_python

vinca/snapshot.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import argparse
22
import yaml
3+
import datetime
34
from .distro import Distro
45

56

@@ -30,7 +31,7 @@ def main():
3031
"--output",
3132
type=str,
3233
dest="output",
33-
default="snapshot.yaml",
34+
default="rosdistro_snapshot.yaml",
3435
help="Output file to write dependencies to",
3536
required=False,
3637
)
@@ -44,6 +45,9 @@ def main():
4445
)
4546
args = parser.parse_args()
4647

48+
# Get the current UTC time
49+
utc_time = datetime.datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%SZ")
50+
4751
distro = Distro(args.distro)
4852

4953
if args.package is None:
@@ -72,4 +76,5 @@ def main():
7276
print("{0:{2}} {1}".format(dep, version, max_len + 2))
7377

7478
with open(args.output, "w") as f:
79+
f.write(f"# Snapshot generated by vinca-snapshot on {utc_time} UTC for distro {args.distro}\n")
7580
yaml.dump(output, f)

0 commit comments

Comments
 (0)