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
a7514993
Kaydet (Commit)
a7514993
authored
May 25, 2010
tarafından
Tarek Ziadé
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Made sysconfig a script that displays useful information - #8770
üst
4fb18010
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
64 additions
and
2 deletions
+64
-2
sysconfig.rst
Doc/library/sysconfig.rst
+32
-0
sysconfig.py
Lib/sysconfig.py
+19
-0
test_sysconfig.py
Lib/test/test_sysconfig.py
+10
-2
NEWS
Misc/NEWS
+3
-0
No files found.
Doc/library/sysconfig.rst
Dosyayı görüntüle @
a7514993
...
@@ -216,3 +216,35 @@ Other functions
...
@@ -216,3 +216,35 @@ Other functions
.. function:: get_config_h_filename()
.. function:: get_config_h_filename()
Return the path of :file:`pyconfig.h`.
Return the path of :file:`pyconfig.h`.
Using :mod:`sysconfig` as a script
----------------------------------
You can use :mod:`sysconfig` as a script with Python's *-m* option::
$ python -m sysconfig
Platform: "macosx-10.4-i386"
Python version: "3.2"
Current installation scheme: "posix_prefix"
Paths:
data = "/usr/local"
include = "/Users/tarek/Dev/svn.python.org/py3k/Include"
platinclude = "."
platlib = "/usr/local/lib/python3.2/site-packages"
platstdlib = "/usr/local/lib/python3.2"
purelib = "/usr/local/lib/python3.2/site-packages"
scripts = "/usr/local/bin"
stdlib = "/usr/local/lib/python3.2"
Variables:
AC_APPLE_UNIVERSAL_BUILD = "0"
AIX_GENUINE_CPLUSPLUS = "0"
AR = "ar"
ARFLAGS = "rc"
ASDLGEN = "./Parser/asdl_c.py"
...
This call will print in the standard output the information returned by
:func:`get_platform`, :func:`get_python_version`, :func:`get_path` and
:func:`get_config_vars`.
Lib/sysconfig.py
Dosyayı görüntüle @
a7514993
...
@@ -686,3 +686,22 @@ def get_platform():
...
@@ -686,3 +686,22 @@ def get_platform():
def
get_python_version
():
def
get_python_version
():
return
_PY_VERSION_SHORT
return
_PY_VERSION_SHORT
def
_print_dict
(
title
,
data
):
for
index
,
(
key
,
value
)
in
enumerate
(
sorted
(
data
.
items
())):
if
index
==
0
:
print
(
'{0}: '
.
format
(
title
))
print
(
'
\t
{0} = "{1}"'
.
format
(
key
,
value
))
def
_main
():
"""Displays all information sysconfig detains."""
print
(
'Platform: "{0}"'
.
format
(
get_platform
()))
print
(
'Python version: "{0}"'
.
format
(
get_python_version
()))
print
(
'Current installation scheme: "{0}"'
.
format
(
_get_default_scheme
()))
print
(
''
)
_print_dict
(
'Paths'
,
get_paths
())
print
(
''
)
_print_dict
(
'Variables'
,
get_config_vars
())
if
__name__
==
'__main__'
:
_main
()
Lib/test/test_sysconfig.py
Dosyayı görüntüle @
a7514993
...
@@ -11,13 +11,14 @@ import subprocess
...
@@ -11,13 +11,14 @@ import subprocess
import
shutil
import
shutil
from
copy
import
copy
,
deepcopy
from
copy
import
copy
,
deepcopy
from
test.support
import
run_unittest
,
TESTFN
,
unlink
,
get_attribute
from
test.support
import
(
run_unittest
,
TESTFN
,
unlink
,
get_attribute
,
captured_stdout
)
import
sysconfig
import
sysconfig
from
sysconfig
import
(
get_paths
,
get_platform
,
get_config_vars
,
from
sysconfig
import
(
get_paths
,
get_platform
,
get_config_vars
,
get_path
,
get_path_names
,
_INSTALL_SCHEMES
,
get_path
,
get_path_names
,
_INSTALL_SCHEMES
,
_get_default_scheme
,
_expand_vars
,
_get_default_scheme
,
_expand_vars
,
get_scheme_names
,
get_config_var
)
get_scheme_names
,
get_config_var
,
_main
)
class
TestSysConfig
(
unittest
.
TestCase
):
class
TestSysConfig
(
unittest
.
TestCase
):
...
@@ -264,6 +265,13 @@ class TestSysConfig(unittest.TestCase):
...
@@ -264,6 +265,13 @@ class TestSysConfig(unittest.TestCase):
user_path
=
get_path
(
name
,
'posix_user'
)
user_path
=
get_path
(
name
,
'posix_user'
)
self
.
assertEquals
(
user_path
,
global_path
.
replace
(
base
,
user
))
self
.
assertEquals
(
user_path
,
global_path
.
replace
(
base
,
user
))
def
test_main
(
self
):
# just making sure _main() runs and returns things in the stdout
with
captured_stdout
()
as
output
:
_main
()
self
.
assertTrue
(
len
(
output
.
getvalue
()
.
split
(
'
\n
'
))
>
0
)
def
test_main
():
def
test_main
():
run_unittest
(
TestSysConfig
)
run_unittest
(
TestSysConfig
)
...
...
Misc/NEWS
Dosyayı görüntüle @
a7514993
...
@@ -392,6 +392,9 @@ C-API
...
@@ -392,6 +392,9 @@ C-API
Library
Library
-------
-------
- Issue #8770: now sysconfig displays information when it's called as
a script. Initial idea by Sridhar Ratnakumar.
- Issue #6662: Fix parsing of malformatted charref (&#bad;), patch written by
- Issue #6662: Fix parsing of malformatted charref (&#bad;), patch written by
Fredrik Håård
Fredrik Håård
...
...
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