DefaultDepotMap.py #1

  • //
  • guest/
  • sven_erik_knop/
  • P4Pythonlib/
  • triggers/
  • DefaultDepotMap.py
  • View
  • Commits
  • Open Download .zip Download (665 B)
#!/usr/bin/env python

from __future__ import print_function
import P4
import sys

def set_map(filename, basePath):
    p4 = P4.P4()

    with open(filename) as f:
        content = f.read()
    depotSpec = p4.parse_depot(content)
    
    depot = depotSpec['Depot']
         
    depotMap = basePath + "/" + depot + "/..."

    depotSpec['Map'] = depotMap

    content = p4.format_depot(depotSpec)

    with open(filename, "w") as f:
        f.write(content)

if __name__ == "__main__":
    if len(sys.argv) < 3:
        print("Usage: depotspec basepath")
        sys.exit(1)

    filename = sys.argv[1]
    basePath = sys.argv[2]

    set_map(filename, basePath)
# Change User Description Committed
#1 8388 Sven Erik Knop Little script to set the default map for Perforce Servers which keep the depots
   out of the P4ROOT directory.