Skip to content
Snippets Groups Projects
Select Git revision
  • b322ffae6c5d571dda9b678c39d59e00f16cf9e1
  • main default protected
  • 24.0 protected
  • 21.2 protected
  • dbiswas-main-patch-15352
  • rpozzi-rmsLArPlot
  • 23.0.32-patches protected
  • 22.0-mc20 protected
  • adye-main-patch-69913
  • 23.0.20-patches protected
  • 24.0.88-patches protected
  • 24.0.42-patches protected
  • 21.0-mc16a protected
  • 21.0-mc16d protected
  • 21.0 protected
  • 23.0 protected
  • averbyts-main-patch-58900
  • 24.0.100-patches protected
  • 24.0.98-patches protected
  • refactor-jet-physvalidation-simple
  • fgiuli_ATR-31358
  • nightly/main/2025-09-22T2100
  • nightly/24.0/2025-09-22T2100
  • nightly/21.2/2025-09-23T0010
  • nightly/24.0/2025-09-21T2100
  • nightly/24.0/2025-09-20T2100
  • nightly/main/2025-09-20T2100
  • nightly/main/2025-09-21T2100
  • release/24.0.112 protected
  • nightly/main/2025-09-19T2100
  • nightly/24.0/2025-09-19T2100
  • release/25.2.66 protected
  • nightly/main/2025-09-18T2100
  • nightly/24.0/2025-09-18T2100
  • nightly/main/2025-09-17T2100
  • nightly/24.0/2025-09-17T2100
  • nightly/main/2025-09-16T2100
  • nightly/24.0/2025-09-16T2100
  • nightly/main/2025-09-15T2100
  • nightly/24.0/2025-09-15T2100
  • release/25.2.65 protected
41 results

bwdcompat.py

Blame
  • user avatar
    Stewart Martin-Haugh authored
    Former-commit-id: 2db86708
    165e4f87
    History
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    bwdcompat.py 1.09 KiB
    # Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
    
    import subprocess
    
    ### monkey-patch subprocess (fwd compat w/ py-3.x) ----------------------------
    def getstatusoutput(cmd, *popenargs, **kwargs):
        if isinstance(cmd, basestring):
            cmd = cmd.split()
        if 'stdout' in kwargs:
            raise ValueError('stdout argument not allowed, it will be overridden.')
        kwargs['stdout'] = subprocess.PIPE
        p = subprocess.Popen(cmd, *popenargs, **kwargs)
        sc = p.returncode
        if sc is None:
            sc = 0
        fd = p.stdout
        out= ''.join(list(fd.readlines()))
        if out[-1:] == '\n': out = out[:-1]
        return sc,out
    subprocess.getstatusoutput = getstatusoutput
    del getstatusoutput
    
    def getstatus(cmd, *popenargs, **kwargs):
        return subprocess.getstatusoutput(cmd, *popenargs, **kwargs)[0]
    subprocess.getstatus = getstatus
    del getstatus
    
    def getoutput(cmd, *popenargs, **kwargs):
        return subprocess.getstatusoutput(cmd, *popenargs, **kwargs)[1]
    subprocess.getoutput = getoutput
    del getoutput
    ### ---------------------------------------------------------------------------