mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-22 14:11:07 +02:00
build_library/check_root: Port to python3
The script needs to be ported, because it is importing portage code which became python3 only. The porting I did is likely a lousy job, but at least it stopped failing with some p(yt)hony errors.
This commit is contained in:
parent
917d12cd7e
commit
647690e264
@ -1,11 +1,9 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
# Copyright (c) 2015 The CoreOS Authors. All rights reserved.
|
# Copyright (c) 2015 The CoreOS Authors. All rights reserved.
|
||||||
# Use of this source code is governed by a BSD-style license that can be
|
# Use of this source code is governed by a BSD-style license that can be
|
||||||
# found in the LICENSE file.
|
# found in the LICENSE file.
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import fnmatch
|
import fnmatch
|
||||||
import os
|
import os
|
||||||
import stat
|
import stat
|
||||||
@ -106,12 +104,12 @@ IGNORE_MISSING = {
|
|||||||
USR_LINKS = ("/bin/", "/sbin/", "/lib/", "/lib32/", "/lib64/")
|
USR_LINKS = ("/bin/", "/sbin/", "/lib/", "/lib32/", "/lib64/")
|
||||||
|
|
||||||
IGNORE_SHEBANG = (
|
IGNORE_SHEBANG = (
|
||||||
b"*/python[0-9].[0-9]/cgi.py",
|
"*/python[0-9].[0-9]/cgi.py",
|
||||||
b"*/usr/lib64/modules/*/source/scripts/*",
|
"*/usr/lib64/modules/*/source/scripts/*",
|
||||||
b"*/usr/share/nova-agent/*/etc/gentoo/nova-agent",
|
"*/usr/share/nova-agent/*/etc/gentoo/nova-agent",
|
||||||
b"*/tmp/*",
|
"*/tmp/*",
|
||||||
b"*/Documentation/*",
|
"*/Documentation/*",
|
||||||
b"*/doc/*",
|
"*/doc/*",
|
||||||
)
|
)
|
||||||
|
|
||||||
IGNORE_SYMLINK = (
|
IGNORE_SYMLINK = (
|
||||||
@ -145,7 +143,7 @@ def provided_sonames():
|
|||||||
|
|
||||||
|
|
||||||
def ignore_sonames(cpv):
|
def ignore_sonames(cpv):
|
||||||
for key in dep.match_to_list(cpv, IGNORE_MISSING.iterkeys()):
|
for key in dep.match_to_list(cpv, IGNORE_MISSING.keys()):
|
||||||
for atom in IGNORE_MISSING[key]:
|
for atom in IGNORE_MISSING[key]:
|
||||||
yield atom
|
yield atom
|
||||||
|
|
||||||
@ -231,10 +229,11 @@ def check_shebang():
|
|||||||
continue
|
continue
|
||||||
if not is_exe(path):
|
if not is_exe(path):
|
||||||
continue
|
continue
|
||||||
with open(path, "r") as fd:
|
with open(path, "rb") as fd:
|
||||||
line = fd.readline(80)
|
line = fd.readline(80)
|
||||||
if not line.startswith(b"#!"):
|
if not line.startswith(b"#!"):
|
||||||
continue
|
continue
|
||||||
|
line = line.decode('utf-8')
|
||||||
args = line[2:].rstrip().split(None, 2)
|
args = line[2:].rstrip().split(None, 2)
|
||||||
cmd = args.pop(0)
|
cmd = args.pop(0)
|
||||||
if cmd in ('/usr/bin/env', '/bin/env') and args:
|
if cmd in ('/usr/bin/env', '/bin/env') and args:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user