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
e57c96ee
Kaydet (Commit)
e57c96ee
authored
Agu 17, 1996
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
site customization hook...
üst
bf51afa0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
0 deletions
+47
-0
site.py
Lib/site.py
+47
-0
No files found.
Lib/site.py
0 → 100644
Dosyayı görüntüle @
e57c96ee
"""Hook to allow easy access to site-specific modules.
Scripts or modules that need to use site-specific modules should place
import site
somewhere near the top of their code. This will append up to two
site-specific paths ($prefix/lib/site-python and
$exec_prefix/lib/site-python) to the module search path. ($prefix
and $exec_prefix are configuration parameters, and both default
to /usr/local; they are accessible in Python as sys.prefix and
sys.exec_prefix).
Because of Python's import semantics, it is okay for more than one
module to import site -- only the first one will execute the site
customizations. The directories are only appended to the path if they
exist and are not already on it.
Sites that wish to provide site-specific modules should place them in
one of the site specific directories; $prefix/lib/site-python is for
Python source code and $exec_prefix/lib/site-python is for dynamically
loadable extension modules (shared libraries).
After these path manipulations, an attempt is made to import a module
named sitecustomize, which can perform arbitrary site-specific
customizations. If this import fails with an ImportError exception,
it is ignored.
Note that for non-Unix systems, sys.prefix and sys.exec_prefix are
empty, and the path manipulations are skipped; however the import of
sitecustomize is still attempted.
XXX Any suggestions as to how to handle this for non-Unix systems???
"""
import
sys
,
os
for
prefix
in
sys
.
prefix
,
sys
.
exec_prefix
:
if
prefix
:
sitedir
=
os
.
path
.
join
(
prefix
,
os
.
path
.
join
(
"lib"
,
"site-python"
))
if
sitedir
not
in
sys
.
path
and
os
.
path
.
isdir
(
sitedir
):
sys
.
path
.
append
(
sitedir
)
# Add path component
try
:
import
sitecustomize
# Run arbitrary site specific code
except
ImportError
:
pass
# No site customization module
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