#!/usr/bin/env python """ This module is a convenience for other modules in this directory """ # Python 2.7/3.3 compatibility. from __future__ import print_function import os import sys import platform class SDPUtils: def __init__(self, sdp_instance): self.sdp_instance = sdp_instance # Python 2.7/3.3 compatibility. if sys.version_info[0] >= 3: import configparser self.rawconfig = configparser.RawConfigParser() else: import ConfigParser self.rawconfig = ConfigParser.RawConfigParser() ########################################################################## ##### ##### ##### CONFIGURATION VARIABLES: Modify in maintenance.cfg as needed. ##### ##### ##### self.rawconfig.read('maintenance.cfg') self.server = os.environ.get('P4PORT') self.p4user = os.environ.get('P4USER'). if platform.system() == "Windows": self.p4 = "p4.exe -p %s -u %s" % (self.server, self.p4user) else: self.p4 = "/p4/%s/bin/p4_%s -u %s -p %s" % (self.sdp_instance, self.sdp_instance, self.p4user, self.server) self.p4_noport = "/p4/%s/bin/p4_%s -u %s" % (self.sdp_instance, self.sdp_instance, self.p4user) def get(self, varname): return self.rawconfig.get(self.sdp_instance, varname) def login(self, port=os.environ.get('P4PORT')): os.system('%s -p %s login -a < /p4/common/config/.p4passwd.p4_%s.admin' % (self.p4_noport, port, self.sdp_instance))
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#5 | 25025 | Russell C. Jackson (Rusty) | Fixed typo in sdputils.py and forced cfgweeks to be an int. | ||
#4 | 24964 | Russell C. Jackson (Rusty) | Corrected type and ordering issue. | ||
#3 | 24675 | Russell C. Jackson (Rusty) |
Fixed bugs in sdputils.py and scripts using it. Converted to standard 2 space spacing, removed copyright stuff. |
||
#2 | 24648 | Russell C. Jackson (Rusty) |
Updated p4deleteuser to support deleting workspaces off edge servers. Added -a to login in sdputils. |
||
#1 | 22693 | Russell C. Jackson (Rusty) |
Branched a Unix only version of the SDP. Removed extra items to create a cleaner tree. Moved a few items around to make more sense without Windows in the mix. |
||
//guest/perforce_software/sdp/dev/Maintenance/sdputils.py | |||||
#2 | 22337 | Russell C. Jackson (Rusty) | Added +x to file types. | ||
#1 | 16638 | C. Thomas Tyler |
Routine merge down to dev from main using: p4 merge -b perforce_software-sdp-dev |
||
//guest/perforce_software/sdp/main/Maintenance/sdputils.py | |||||
#1 | 16581 | Robert Cowham |
Standardised processing and formatting. Made python 2/3 compatible. These need automated testing! |