commit:     7748284a8002b4d3cf44cc0cd24738aebeb8b548
Author:     Mike Frysinger <vapier <AT> chromium <DOT> org>
AuthorDate: Fri Apr 16 01:13:13 2021 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Fri Apr 16 01:13:13 2021 +0000
URL:        https://gitweb.gentoo.org/proj/pax-utils.git/commit/?id=7748284a

lddtree: require Python 3.6+

Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

 lddtree.py | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/lddtree.py b/lddtree.py
index 3420b7d..b65c3f2 100755
--- a/lddtree.py
+++ b/lddtree.py
@@ -1,5 +1,4 @@
 #!/usr/bin/env python
-# -*- coding: utf-8 -*-
 # Copyright 2012-2014 Gentoo Foundation
 # Copyright 2012-2014 Mike Frysinger <[email protected]>
 # Copyright 2012-2014 The Chromium OS Authors
@@ -40,8 +39,6 @@ This will place bash, lspci, and lsof into /foo/bin/.  All 
the libraries
 they need will be placed into /foo/lib/ only.
 """
 
-from __future__ import print_function
-
 import argparse
 import glob
 import errno
@@ -49,6 +46,8 @@ import os
 import shutil
 import sys
 
+assert sys.version_info >= (3, 6), f'Python 3.6+ required, but found 
{sys.version}'
+
 from elftools.elf.elffile import ELFFile
 from elftools.common import exceptions
 
@@ -116,15 +115,6 @@ def readlink(path, root, prefixed=False):
     return normpath((root + path) if prefixed else path)
 
 
-def makedirs(path):
-    """Like os.makedirs(), but ignore EEXIST errors"""
-    try:
-        os.makedirs(path)
-    except OSError as e:
-        if e.errno != errno.EEXIST:
-            raise
-
-
 def dedupe(items):
     """Remove all duplicates from |items| (keeping order)"""
     seen = {}
@@ -596,7 +586,7 @@ def _ActionCopy(options, elf):
         if options.verbose:
             print('%s -> %s' % (src, dst))
 
-        makedirs(os.path.dirname(dst))
+        os.makedirs(os.path.dirname(dst), exist_ok=True)
         try:
             shutil.copy2(realsrc, dst)
         except IOError:

Reply via email to