Add a far maker
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2103 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
21
Tools/Python/WorkspaceRoutines.py
Executable file
21
Tools/Python/WorkspaceRoutines.py
Executable file
@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import os, sys, re, getopt, string, glob, xml.dom.minidom, pprint, md5, socket, getpass, time, random
|
||||
|
||||
def inWorkspace(rel_path=""):
|
||||
"""Treat the given path as relative to the workspace."""
|
||||
|
||||
# Make sure the user has set the workspace variable:
|
||||
try:
|
||||
return os.path.join(os.environ["WORKSPACE"], rel_path )
|
||||
except:
|
||||
print "Oops! You must set the WORKSPACE environment variable to run this script."
|
||||
sys.exit()
|
||||
|
||||
def genguid():
|
||||
g = md5.md5(
|
||||
str(random.random()) +
|
||||
getpass.getuser() +
|
||||
str(time.time()) +
|
||||
socket.gethostbyname(socket.gethostname())).hexdigest()
|
||||
return "%s-%s-%s-%s-%s" % (g[0:8], g[8:12], g[12:16], g[16:20], g[20:])
|
Reference in New Issue
Block a user