You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
1.1 KiB

  1. #!/usr/bin/env python
  2. from argparse import ArgumentParser
  3. from pathlib import Path
  4. import shutil
  5. def fill_mock_backup_dir(rootdir: Path, target_dir: Path, verbose=False):
  6. if (target_dir / "marker").exists():
  7. return
  8. for property_file in rootdir.glob("*.properties"):
  9. if verbose:
  10. print(f"Property file: {property_file}")
  11. shutil.copy2(property_file, target_dir / property_file.name)
  12. for other_file in filter(
  13. lambda path: path.suffix != ".properties", rootdir.glob("*")
  14. ):
  15. if other_file.is_file():
  16. if verbose:
  17. print(f"Data/apk file: {other_file}")
  18. dest = target_dir / other_file.name
  19. dest.touch(exist_ok=True)
  20. (target_dir / "marker").touch()
  21. if __name__ == "__main__":
  22. parser = ArgumentParser()
  23. parser.add_argument("backup_dir", type=Path)
  24. parser.add_argument("mock_dir", default=".", type=Path, nargs="?")
  25. parser.add_argument("-v", "--verbose", action="store_true")
  26. args = parser.parse_args()
  27. fill_mock_backup_dir(args.backup_dir, args.mock_dir, args.verbose)