def snapshot(snapshot_dir_args): """ Perform the snapshot using the SnapshotDir utility from TriBITS. Parameters: shapshot_dir_args (str): The arguments to pass to SnapshotDir. Returns: bool: Whether or not the snapshot was successful. Note: The SnapshotDir utility is already unit tested within TriBITS, so there's no need for an additional test here. """ import SnapshotDir return SnapshotDir.snapshotDirMainDriver(snapshot_dir_args)
checkinTestFilePath = os.path.abspath(sys.argv[0]) checkinTestFileRealPath = os.path.realpath(checkinTestFilePath) scriptsDir = os.path.dirname(checkinTestFileRealPath)+"/python" #print("scriptsDir='" + scriptsDir + "'") sys.path.insert(0, scriptsDir) # # Import and run # import SnapshotDir snapshotDirDummyDefaults = os.environ.get("SNAPSHOT_DIR_DUMMY_DEFAULTS","") defaultOptions = None if snapshotDirDummyDefaults: defaultOptions = SnapshotDir.DefaultOptions() defaultOptions.origDir = "<orig-dir>" defaultOptions.destDir = "<dest-dir>" success = SnapshotDir.snapshotDirMainDriver(sys.argv[1:], defaultOptions) if success: rtnCode = 0 else: rtnCode = 1 sys.exit(rtnCode)
#!/usr/bin/env python import sys import os # # Get the location of the scripts directory whether from a sym link or the # actual # checkinTestFilePath = os.path.abspath(sys.argv[0]) checkinTestFileRealPath = os.path.realpath(checkinTestFilePath) scriptsDir = os.path.dirname(checkinTestFileRealPath)+"/python" print "scriptsDir='"+scriptsDir+"'" sys.path.insert(0, scriptsDir) # # Import and run # import SnapshotDir success = SnapshotDir.snapshotDirMainDriver(sys.argv[1:]) if success: rtnCode = 0 else: rtnCode = 1 sys.exit(rtnCode)
# # ************************************************************************ # @HEADER import sys import os # # Get the location of the scripts directory whether from a sym link or the # actual # checkinTestFilePath = os.path.abspath(sys.argv[0]) checkinTestFileRealPath = os.path.realpath(checkinTestFilePath) scriptsDir = os.path.dirname(checkinTestFileRealPath)+"/python" #print "scriptsDir='"+scriptsDir+"'" sys.path.insert(0, scriptsDir) # # Import and run # import SnapshotDir success = SnapshotDir.snapshotDirMainDriver(sys.argv[1:]) if success: rtnCode = 0 else: rtnCode = 1 sys.exit(rtnCode)
checkinTestFilePath = os.path.abspath(sys.argv[0]) checkinTestFileRealPath = os.path.realpath(checkinTestFilePath) scriptsDir = os.path.dirname(checkinTestFileRealPath)+"/python" #print "scriptsDir='"+scriptsDir+"'" sys.path.insert(0, scriptsDir) # # Import and run # import SnapshotDir snapshotDirDummyDefaults = os.environ.get("SNAPSHOT_DIR_DUMMY_DEFAULTS","") defaultOptions = None if snapshotDirDummyDefaults: defaultOptions = SnapshotDir.DefaultOptions() defaultOptions.origDir = "<orig-dir>" defaultOptions.destDir = "<dest-dir>" success = SnapshotDir.snapshotDirMainDriver(sys.argv[1:], defaultOptions) if success: rtnCode = 0 else: rtnCode = 1 sys.exit(rtnCode)