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
fa012610
Kaydet (Commit)
fa012610
authored
Nis 24, 2003
tarafından
Skip Montanaro
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
new method: has_function() - returns a boolean indicating whether the
argument function is available on the current platform
üst
8ed06da7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
0 deletions
+45
-0
ccompiler.py
Lib/distutils/ccompiler.py
+45
-0
No files found.
Lib/distutils/ccompiler.py
Dosyayı görüntüle @
fa012610
...
...
@@ -883,6 +883,51 @@ class CCompiler:
"""
raise
NotImplementedError
def
has_function
(
self
,
funcname
,
includes
=
None
,
include_dirs
=
None
,
libraries
=
None
,
library_dirs
=
None
):
"""Return a boolean indicating whether funcname is supported on
the current platform. The optional arguments can be used to
augment the compilation environment.
"""
# this can't be included at module scope because it tries to
# import math which might not be available at that point - maybe
# the necessary logic should just be inlined?
import
tempfile
if
includes
is
None
:
includes
=
[]
if
include_dirs
is
None
:
include_dirs
=
[]
if
libraries
is
None
:
libraries
=
[]
if
library_dirs
is
None
:
library_dirs
=
[]
fd
,
fname
=
tempfile
.
mkstemp
(
".c"
,
funcname
,
text
=
True
)
f
=
os
.
fdopen
(
fd
,
"w"
)
for
incl
in
includes
:
f
.
write
(
"""#include "
%
s"
\n
"""
%
incl
)
f
.
write
(
"""
\
main (int argc, char **argv) {
%
s();
}
"""
%
funcname
)
f
.
close
()
try
:
objects
=
self
.
compile
([
fname
],
include_dirs
=
include_dirs
)
except
CompileError
:
return
False
try
:
self
.
link_executable
(
objects
,
"a.out"
,
libraries
=
libraries
,
library_dirs
=
library_dirs
)
except
(
LinkError
,
TypeError
):
return
False
return
True
def
find_library_file
(
self
,
dirs
,
lib
,
debug
=
0
):
"""Search the specified list of directories for a static or shared
library file 'lib' and return the full path to that file. If
...
...
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