]> git.proxmox.com Git - mirror_edk2.git/blame - Tools/Python/WorkspaceRoutines.py
Added some new field to the far template.
[mirror_edk2.git] / Tools / Python / WorkspaceRoutines.py
CommitLineData
e853a9d4 1#!/usr/bin/env python
2
3import os, sys, re, getopt, string, glob, xml.dom.minidom, pprint, md5, socket, getpass, time, random
4
5def inWorkspace(rel_path=""):
6 """Treat the given path as relative to the workspace."""
7
8 # Make sure the user has set the workspace variable:
9 try:
10 return os.path.join(os.environ["WORKSPACE"], rel_path )
11 except:
12 print "Oops! You must set the WORKSPACE environment variable to run this script."
13 sys.exit()
14
15def genguid():
16 g = md5.md5(
17 str(random.random()) +
18 getpass.getuser() +
19 str(time.time()) +
20 socket.gethostbyname(socket.gethostname())).hexdigest()
21 return "%s-%s-%s-%s-%s" % (g[0:8], g[8:12], g[12:16], g[16:20], g[20:])
af2efcaf 22
23def lean(path):
24 """Lean the slashes forward"""
25
26 return os.path.normpath(path).replace("\\", "/")