Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
c0919c27
Unverified
Kaydet (Commit)
c0919c27
authored
Ara 23, 2017
tarafından
Mariatta
Kaydeden (comit)
GitHub
Ara 23, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-26439: Convert %s in Lib/ctypes/_aix.py to f-strings. (GH-4986)
üst
d11e8e0d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
17 deletions
+17
-17
_aix.py
Lib/ctypes/_aix.py
+9
-9
util.py
Lib/ctypes/util.py
+8
-8
No files found.
Lib/ctypes/_aix.py
Dosyayı görüntüle @
c0919c27
...
...
@@ -105,7 +105,7 @@ def get_ld_headers(file):
# 2. If "INDEX" in occurs in a following line - return ld_header
# 3. get info (lines starting with [0-9])
ldr_headers
=
[]
p
=
Popen
([
"/usr/bin/dump"
,
"-X
%
s"
%
AIX_ABI
,
"-H"
,
file
],
p
=
Popen
([
"/usr/bin/dump"
,
f
"-X{AIX_ABI}"
,
"-H"
,
file
],
universal_newlines
=
True
,
stdout
=
PIPE
,
stderr
=
DEVNULL
)
# be sure to read to the end-of-file - getting all entries
while
True
:
...
...
@@ -140,7 +140,7 @@ def get_one_match(expr, lines):
When there is a match, strip leading "[" and trailing "]"
"""
# member names in the ld_headers output are between square brackets
expr
=
r
'\[(
%
s)\]'
%
expr
expr
=
r
f
'
\
[({expr})
\
]'
matches
=
list
(
filter
(
None
,
(
re
.
search
(
expr
,
line
)
for
line
in
lines
)))
if
len
(
matches
)
==
1
:
return
matches
[
0
]
.
group
(
1
)
...
...
@@ -197,8 +197,8 @@ def get_version(name, members):
# any combination of additional 'dot' digits pairs are accepted
# anything more than libFOO.so.digits.digits.digits
# should be seen as a member name outside normal expectations
exprs
=
[
r
'lib
%
s\.so\.[0-9]+[0-9.]*'
%
name
,
r
'lib
%
s_?64\.so\.[0-9]+[0-9.]*'
%
name
]
exprs
=
[
r
f
'lib{name}
\
.so
\
.[0-9]+[0-9.]*'
,
r
f
'lib{name}_?64
\
.so
\
.[0-9]+[0-9.]*'
]
for
expr
in
exprs
:
versions
=
[]
for
line
in
members
:
...
...
@@ -219,12 +219,12 @@ def get_member(name, members):
and finally, legacy AIX naming scheme.
"""
# look first for a generic match - prepend lib and append .so
expr
=
r
'lib
%
s\.so'
%
name
expr
=
r
f
'lib{name}
\
.so'
member
=
get_one_match
(
expr
,
members
)
if
member
:
return
member
elif
AIX_ABI
==
64
:
expr
=
r
'lib
%
s64\.so'
%
name
expr
=
r
f
'lib{name}64
\
.so'
member
=
get_one_match
(
expr
,
members
)
if
member
:
return
member
...
...
@@ -277,7 +277,7 @@ def find_shared(paths, name):
continue
# "lib" is prefixed to emulate compiler name resolution,
# e.g., -lc to libc
base
=
'lib
%
s.a'
%
name
base
=
f
'lib{name}.a'
archive
=
path
.
join
(
dir
,
base
)
if
path
.
exists
(
archive
):
members
=
get_shared
(
get_ld_headers
(
archive
))
...
...
@@ -308,7 +308,7 @@ def find_library(name):
libpaths
=
get_libpaths
()
(
base
,
member
)
=
find_shared
(
libpaths
,
name
)
if
base
!=
None
:
return
"
%
s(
%
s)"
%
(
base
,
member
)
return
f
"{base}({member})"
# To get here, a member in an archive has not been found
# In other words, either:
...
...
@@ -319,7 +319,7 @@ def find_library(name):
# Note, the installation must prepare a link from a .so
# to a versioned file
# This is common practice by GNU libtool on other platforms
soname
=
"lib
%
s.so"
%
name
soname
=
f
"lib{name}.so"
for
dir
in
libpaths
:
# /lib is a symbolic link to /usr/lib, skip it
if
dir
==
"/lib"
:
...
...
Lib/ctypes/util.py
Dosyayı görüntüle @
c0919c27
...
...
@@ -337,18 +337,18 @@ def test():
elif
sys
.
platform
.
startswith
(
"aix"
):
from
ctypes
import
CDLL
if
sys
.
maxsize
<
2
**
32
:
print
(
"Using CDLL(name, os.RTLD_MEMBER):
%
s"
%
CDLL
(
"libc.a(shr.o)"
,
os
.
RTLD_MEMBER
)
)
print
(
"Using cdll.LoadLibrary():
%
s"
%
cdll
.
LoadLibrary
(
"libc.a(shr.o)"
)
)
print
(
f
"Using CDLL(name, os.RTLD_MEMBER): {CDLL('libc.a(shr.o)', os.RTLD_MEMBER)}"
)
print
(
f
"Using cdll.LoadLibrary(): {cdll.LoadLibrary('libc.a(shr.o)')}"
)
# librpm.so is only available as 32-bit shared library
print
(
find_library
(
"rpm"
))
print
(
cdll
.
LoadLibrary
(
"librpm.so"
))
else
:
print
(
"Using CDLL(name, os.RTLD_MEMBER):
%
s"
%
CDLL
(
"libc.a(shr_64.o)"
,
os
.
RTLD_MEMBER
)
)
print
(
"Using cdll.LoadLibrary():
%
s"
%
cdll
.
LoadLibrary
(
"libc.a(shr_64.o)"
)
)
print
(
"crypt
\t
::
%
s"
%
find_library
(
"crypt"
)
)
print
(
"crypt
\t
::
%
s"
%
cdll
.
LoadLibrary
(
find_library
(
"crypt"
))
)
print
(
"crypto
\t
::
%
s"
%
find_library
(
"crypto"
)
)
print
(
"crypto
\t
::
%
s"
%
cdll
.
LoadLibrary
(
find_library
(
"crypto"
))
)
print
(
f
"Using CDLL(name, os.RTLD_MEMBER): {CDLL('libc.a(shr_64.o)', os.RTLD_MEMBER)}"
)
print
(
f
"Using cdll.LoadLibrary(): {cdll.LoadLibrary('libc.a(shr_64.o)')}"
)
print
(
f
"crypt
\t
:: {find_library('crypt')}"
)
print
(
f
"crypt
\t
:: {cdll.LoadLibrary(find_library('crypt'))}"
)
print
(
f
"crypto
\t
:: {find_library('crypto')}"
)
print
(
f
"crypto
\t
:: {cdll.LoadLibrary(find_library('crypto'))}"
)
else
:
print
(
cdll
.
LoadLibrary
(
"libm.so"
))
print
(
cdll
.
LoadLibrary
(
"libcrypt.so"
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment