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
be86bdea
Kaydet (Commit)
be86bdea
authored
Eyl 26, 2000
tarafından
Greg Ward
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Standardize whitespace in function calls.
üst
fd7b91ef
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
83 additions
and
83 deletions
+83
-83
core.py
Lib/distutils/core.py
+3
-3
unixccompiler.py
Lib/distutils/unixccompiler.py
+44
-44
util.py
Lib/distutils/util.py
+12
-12
version.py
Lib/distutils/version.py
+24
-24
No files found.
Lib/distutils/core.py
Dosyayı görüntüle @
be86bdea
...
...
@@ -84,7 +84,7 @@ def setup (**attrs):
# Determine the distribution class -- either caller-supplied or
# our Distribution (see below).
klass
=
attrs
.
get
(
'distclass'
)
klass
=
attrs
.
get
(
'distclass'
)
if
klass
:
del
attrs
[
'distclass'
]
else
:
...
...
@@ -98,7 +98,7 @@ def setup (**attrs):
# Create the Distribution instance, using the remaining arguments
# (ie. everything except distclass) to initialize it
try
:
_setup_distribution
=
dist
=
klass
(
attrs
)
_setup_distribution
=
dist
=
klass
(
attrs
)
except
DistutilsSetupError
,
msg
:
raise
SystemExit
,
"error in setup script:
%
s"
%
msg
...
...
@@ -135,7 +135,7 @@ def setup (**attrs):
# And finally, run all the commands found on the command line.
if
ok
:
try
:
dist
.
run_commands
()
dist
.
run_commands
()
except
KeyboardInterrupt
:
raise
SystemExit
,
"interrupted"
except
(
IOError
,
os
.
error
),
exc
:
...
...
Lib/distutils/unixccompiler.py
Dosyayı görüntüle @
be86bdea
...
...
@@ -91,8 +91,8 @@ class UnixCCompiler (CCompiler):
extra_postargs
=
None
):
(
_
,
macros
,
include_dirs
)
=
\
self
.
_fix_compile_args
(
None
,
macros
,
include_dirs
)
pp_opts
=
gen_preprocess_options
(
macros
,
include_dirs
)
self
.
_fix_compile_args
(
None
,
macros
,
include_dirs
)
pp_opts
=
gen_preprocess_options
(
macros
,
include_dirs
)
pp_args
=
self
.
preprocessor
+
pp_opts
if
output_file
:
pp_args
.
extend
([
'-o'
,
output_file
])
...
...
@@ -108,7 +108,7 @@ class UnixCCompiler (CCompiler):
if
output_file
:
self
.
mkpath
(
os
.
path
.
dirname
(
output_file
))
try
:
self
.
spawn
(
pp_args
)
self
.
spawn
(
pp_args
)
except
DistutilsExecError
,
msg
:
raise
CompileError
,
msg
...
...
@@ -123,11 +123,11 @@ class UnixCCompiler (CCompiler):
extra_postargs
=
None
):
(
output_dir
,
macros
,
include_dirs
)
=
\
self
.
_fix_compile_args
(
output_dir
,
macros
,
include_dirs
)
(
objects
,
skip_sources
)
=
self
.
_prep_compile
(
sources
,
output_dir
)
self
.
_fix_compile_args
(
output_dir
,
macros
,
include_dirs
)
(
objects
,
skip_sources
)
=
self
.
_prep_compile
(
sources
,
output_dir
)
# Figure out the options for the compiler command line.
pp_opts
=
gen_preprocess_options
(
macros
,
include_dirs
)
pp_opts
=
gen_preprocess_options
(
macros
,
include_dirs
)
cc_args
=
pp_opts
+
[
'-c'
]
if
debug
:
cc_args
[:
0
]
=
[
'-g'
]
...
...
@@ -138,14 +138,14 @@ class UnixCCompiler (CCompiler):
# Compile all source files that weren't eliminated by
# '_prep_compile()'.
for
i
in
range
(
len
(
sources
)):
for
i
in
range
(
len
(
sources
)):
src
=
sources
[
i
]
;
obj
=
objects
[
i
]
if
skip_sources
[
src
]:
self
.
announce
(
"skipping
%
s (
%
s up-to-date)"
%
(
src
,
obj
))
self
.
announce
(
"skipping
%
s (
%
s up-to-date)"
%
(
src
,
obj
))
else
:
self
.
mkpath
(
os
.
path
.
dirname
(
obj
))
self
.
mkpath
(
os
.
path
.
dirname
(
obj
))
try
:
self
.
spawn
(
self
.
compiler_so
+
cc_args
+
self
.
spawn
(
self
.
compiler_so
+
cc_args
+
[
src
,
'-o'
,
obj
]
+
extra_postargs
)
except
DistutilsExecError
,
msg
:
...
...
@@ -163,14 +163,14 @@ class UnixCCompiler (CCompiler):
output_dir
=
None
,
debug
=
0
):
(
objects
,
output_dir
)
=
self
.
_fix_object_args
(
objects
,
output_dir
)
(
objects
,
output_dir
)
=
self
.
_fix_object_args
(
objects
,
output_dir
)
output_filename
=
\
self
.
library_filename
(
output_libname
,
output_dir
=
output_dir
)
self
.
library_filename
(
output_libname
,
output_dir
=
output_dir
)
if
self
.
_need_link
(
objects
,
output_filename
):
self
.
mkpath
(
os
.
path
.
dirname
(
output_filename
))
self
.
spawn
(
self
.
archiver
+
if
self
.
_need_link
(
objects
,
output_filename
):
self
.
mkpath
(
os
.
path
.
dirname
(
output_filename
))
self
.
spawn
(
self
.
archiver
+
[
output_filename
]
+
objects
+
self
.
objects
)
...
...
@@ -181,11 +181,11 @@ class UnixCCompiler (CCompiler):
# it for us, hence the check for leading colon.
if
self
.
ranlib
:
try
:
self
.
spawn
(
self
.
ranlib
+
[
output_filename
])
self
.
spawn
(
self
.
ranlib
+
[
output_filename
])
except
DistutilsExecError
,
msg
:
raise
LibError
,
msg
else
:
self
.
announce
(
"skipping
%
s (up-to-date)"
%
output_filename
)
self
.
announce
(
"skipping
%
s (up-to-date)"
%
output_filename
)
# create_static_lib ()
...
...
@@ -203,9 +203,9 @@ class UnixCCompiler (CCompiler):
extra_postargs
=
None
,
build_temp
=
None
):
self
.
link_shared_object
(
self
.
link_shared_object
(
objects
,
self
.
library_filename
(
output_libname
,
lib_type
=
'shared'
),
self
.
library_filename
(
output_libname
,
lib_type
=
'shared'
),
output_dir
,
libraries
,
library_dirs
,
...
...
@@ -230,19 +230,19 @@ class UnixCCompiler (CCompiler):
extra_postargs
=
None
,
build_temp
=
None
):
(
objects
,
output_dir
)
=
self
.
_fix_object_args
(
objects
,
output_dir
)
(
objects
,
output_dir
)
=
self
.
_fix_object_args
(
objects
,
output_dir
)
(
libraries
,
library_dirs
,
runtime_library_dirs
)
=
\
self
.
_fix_lib_args
(
libraries
,
library_dirs
,
runtime_library_dirs
)
self
.
_fix_lib_args
(
libraries
,
library_dirs
,
runtime_library_dirs
)
lib_opts
=
gen_lib_options
(
self
,
lib_opts
=
gen_lib_options
(
self
,
library_dirs
,
runtime_library_dirs
,
libraries
)
if
type
(
output_dir
)
not
in
(
StringType
,
NoneType
):
if
type
(
output_dir
)
not
in
(
StringType
,
NoneType
):
raise
TypeError
,
"'output_dir' must be a string or None"
if
output_dir
is
not
None
:
output_filename
=
os
.
path
.
join
(
output_dir
,
output_filename
)
output_filename
=
os
.
path
.
join
(
output_dir
,
output_filename
)
if
self
.
_need_link
(
objects
,
output_filename
):
if
self
.
_need_link
(
objects
,
output_filename
):
ld_args
=
(
objects
+
self
.
objects
+
lib_opts
+
[
'-o'
,
output_filename
])
if
debug
:
...
...
@@ -250,14 +250,14 @@ class UnixCCompiler (CCompiler):
if
extra_preargs
:
ld_args
[:
0
]
=
extra_preargs
if
extra_postargs
:
ld_args
.
extend
(
extra_postargs
)
self
.
mkpath
(
os
.
path
.
dirname
(
output_filename
))
ld_args
.
extend
(
extra_postargs
)
self
.
mkpath
(
os
.
path
.
dirname
(
output_filename
))
try
:
self
.
spawn
(
self
.
linker_so
+
ld_args
)
self
.
spawn
(
self
.
linker_so
+
ld_args
)
except
DistutilsExecError
,
msg
:
raise
LinkError
,
msg
else
:
self
.
announce
(
"skipping
%
s (up-to-date)"
%
output_filename
)
self
.
announce
(
"skipping
%
s (up-to-date)"
%
output_filename
)
# link_shared_object ()
...
...
@@ -273,32 +273,32 @@ class UnixCCompiler (CCompiler):
extra_preargs
=
None
,
extra_postargs
=
None
):
(
objects
,
output_dir
)
=
self
.
_fix_object_args
(
objects
,
output_dir
)
(
objects
,
output_dir
)
=
self
.
_fix_object_args
(
objects
,
output_dir
)
(
libraries
,
library_dirs
,
runtime_library_dirs
)
=
\
self
.
_fix_lib_args
(
libraries
,
library_dirs
,
runtime_library_dirs
)
self
.
_fix_lib_args
(
libraries
,
library_dirs
,
runtime_library_dirs
)
lib_opts
=
gen_lib_options
(
self
,
lib_opts
=
gen_lib_options
(
self
,
library_dirs
,
runtime_library_dirs
,
libraries
)
output_filename
=
output_progname
# Unix-ism!
if
output_dir
is
not
None
:
output_filename
=
os
.
path
.
join
(
output_dir
,
output_filename
)
output_filename
=
os
.
path
.
join
(
output_dir
,
output_filename
)
if
self
.
_need_link
(
objects
,
output_filename
):
if
self
.
_need_link
(
objects
,
output_filename
):
ld_args
=
objects
+
self
.
objects
+
lib_opts
+
[
'-o'
,
output_filename
]
if
debug
:
ld_args
[:
0
]
=
[
'-g'
]
if
extra_preargs
:
ld_args
[:
0
]
=
extra_preargs
if
extra_postargs
:
ld_args
.
extend
(
extra_postargs
)
self
.
mkpath
(
os
.
path
.
dirname
(
output_filename
))
ld_args
.
extend
(
extra_postargs
)
self
.
mkpath
(
os
.
path
.
dirname
(
output_filename
))
try
:
self
.
spawn
(
self
.
linker_exe
+
ld_args
)
self
.
spawn
(
self
.
linker_exe
+
ld_args
)
except
DistutilsExecError
,
msg
:
raise
LinkError
,
msg
else
:
self
.
announce
(
"skipping
%
s (up-to-date)"
%
output_filename
)
self
.
announce
(
"skipping
%
s (up-to-date)"
%
output_filename
)
# link_executable ()
...
...
@@ -320,18 +320,18 @@ class UnixCCompiler (CCompiler):
def
find_library_file
(
self
,
dirs
,
lib
,
debug
=
0
):
for
dir
in
dirs
:
shared
=
os
.
path
.
join
(
dir
,
self
.
library_filename
(
lib
,
lib_type
=
'shared'
))
static
=
os
.
path
.
join
(
dir
,
self
.
library_filename
(
lib
,
lib_type
=
'static'
))
shared
=
os
.
path
.
join
(
dir
,
self
.
library_filename
(
lib
,
lib_type
=
'shared'
))
static
=
os
.
path
.
join
(
dir
,
self
.
library_filename
(
lib
,
lib_type
=
'static'
))
# We're second-guessing the linker here, with not much hard
# data to go on: GCC seems to prefer the shared library, so I'm
# assuming that *all* Unix C compilers do. And of course I'm
# ignoring even GCC's "-static" option. So sue me.
if
os
.
path
.
exists
(
shared
):
if
os
.
path
.
exists
(
shared
):
return
shared
elif
os
.
path
.
exists
(
static
):
elif
os
.
path
.
exists
(
static
):
return
static
else
:
...
...
Lib/distutils/util.py
Dosyayı görüntüle @
be86bdea
...
...
@@ -88,16 +88,16 @@ def change_root (new_root, pathname):
two, which is tricky on DOS/Windows and Mac OS.
"""
if
os
.
name
==
'posix'
:
if
not
os
.
path
.
isabs
(
pathname
):
return
os
.
path
.
join
(
new_root
,
pathname
)
if
not
os
.
path
.
isabs
(
pathname
):
return
os
.
path
.
join
(
new_root
,
pathname
)
else
:
return
os
.
path
.
join
(
new_root
,
pathname
[
1
:])
return
os
.
path
.
join
(
new_root
,
pathname
[
1
:])
elif
os
.
name
==
'nt'
:
(
drive
,
path
)
=
os
.
path
.
splitdrive
(
pathname
)
(
drive
,
path
)
=
os
.
path
.
splitdrive
(
pathname
)
if
path
[
0
]
==
'
\\
'
:
path
=
path
[
1
:]
return
os
.
path
.
join
(
new_root
,
path
)
return
os
.
path
.
join
(
new_root
,
path
)
elif
os
.
name
==
'mac'
:
if
not
os
.
path
.
isabs
(
pathname
):
...
...
@@ -129,10 +129,10 @@ def check_environ ():
if
os
.
name
==
'posix'
and
not
os
.
environ
.
has_key
(
'HOME'
):
import
pwd
os
.
environ
[
'HOME'
]
=
pwd
.
getpwuid
(
os
.
getuid
())[
5
]
os
.
environ
[
'HOME'
]
=
pwd
.
getpwuid
(
os
.
getuid
())[
5
]
if
not
os
.
environ
.
has_key
(
'PLAT'
):
os
.
environ
[
'PLAT'
]
=
get_platform
()
os
.
environ
[
'PLAT'
]
=
get_platform
()
_environ_checked
=
1
...
...
@@ -147,15 +147,15 @@ def subst_vars (str, local_vars):
'_check_environ()'. Raise ValueError for any variables not found in
either 'local_vars' or 'os.environ'."""
check_environ
()
check_environ
()
def
_subst
(
match
,
local_vars
=
local_vars
):
var_name
=
match
.
group
(
1
)
if
local_vars
.
has_key
(
var_name
):
return
str
(
local_vars
[
var_name
])
if
local_vars
.
has_key
(
var_name
):
return
str
(
local_vars
[
var_name
])
else
:
return
os
.
environ
[
var_name
]
return
re
.
sub
(
r'\$([a-zA-Z_][a-zA-Z_0-9]*)'
,
_subst
,
str
)
return
re
.
sub
(
r'\$([a-zA-Z_][a-zA-Z_0-9]*)'
,
_subst
,
str
)
# subst_vars ()
...
...
@@ -169,7 +169,7 @@ def grok_environment_error (exc, prefix="error: "):
prefixed with 'prefix'.
"""
# check for Python 1.5.2-style {IO,OS}Error exception objects
if
hasattr
(
exc
,
'filename'
)
and
hasattr
(
exc
,
'strerror'
):
if
hasattr
(
exc
,
'filename'
)
and
hasattr
(
exc
,
'strerror'
):
if
exc
.
filename
:
error
=
prefix
+
"
%
s:
%
s"
%
(
exc
.
filename
,
exc
.
strerror
)
else
:
...
...
Lib/distutils/version.py
Dosyayı görüntüle @
be86bdea
...
...
@@ -39,10 +39,10 @@ class Version:
def
__init__
(
self
,
vstring
=
None
):
if
vstring
:
self
.
parse
(
vstring
)
self
.
parse
(
vstring
)
def
__repr__
(
self
):
return
"
%
s ('
%
s')"
%
(
self
.
__class__
.
__name__
,
str
(
self
))
return
"
%
s ('
%
s')"
%
(
self
.
__class__
.
__name__
,
str
(
self
))
# Interface for version-number classes -- must be implemented
...
...
@@ -99,25 +99,25 @@ class StrictVersion (Version):
in the distutils documentation.
"""
version_re
=
re
.
compile
(
r'^(\d+) \. (\d+) (\. (\d+))? ([ab](\d+))?$'
,
version_re
=
re
.
compile
(
r'^(\d+) \. (\d+) (\. (\d+))? ([ab](\d+))?$'
,
re
.
VERBOSE
)
def
parse
(
self
,
vstring
):
match
=
self
.
version_re
.
match
(
vstring
)
match
=
self
.
version_re
.
match
(
vstring
)
if
not
match
:
raise
ValueError
,
"invalid version number '
%
s'"
%
vstring
(
major
,
minor
,
patch
,
prerelease
,
prerelease_num
)
=
\
match
.
group
(
1
,
2
,
4
,
5
,
6
)
match
.
group
(
1
,
2
,
4
,
5
,
6
)
if
patch
:
self
.
version
=
tuple
(
map
(
string
.
atoi
,
[
major
,
minor
,
patch
]))
self
.
version
=
tuple
(
map
(
string
.
atoi
,
[
major
,
minor
,
patch
]))
else
:
self
.
version
=
tuple
(
map
(
string
.
atoi
,
[
major
,
minor
])
+
[
0
])
self
.
version
=
tuple
(
map
(
string
.
atoi
,
[
major
,
minor
])
+
[
0
])
if
prerelease
:
self
.
prerelease
=
(
prerelease
[
0
],
string
.
atoi
(
prerelease_num
))
self
.
prerelease
=
(
prerelease
[
0
],
string
.
atoi
(
prerelease_num
))
else
:
self
.
prerelease
=
None
...
...
@@ -125,21 +125,21 @@ class StrictVersion (Version):
def
__str__
(
self
):
if
self
.
version
[
2
]
==
0
:
vstring
=
string
.
join
(
map
(
str
,
self
.
version
[
0
:
2
]),
'.'
)
vstring
=
string
.
join
(
map
(
str
,
self
.
version
[
0
:
2
]),
'.'
)
else
:
vstring
=
string
.
join
(
map
(
str
,
self
.
version
),
'.'
)
vstring
=
string
.
join
(
map
(
str
,
self
.
version
),
'.'
)
if
self
.
prerelease
:
vstring
=
vstring
+
self
.
prerelease
[
0
]
+
str
(
self
.
prerelease
[
1
])
vstring
=
vstring
+
self
.
prerelease
[
0
]
+
str
(
self
.
prerelease
[
1
])
return
vstring
def
__cmp__
(
self
,
other
):
if
isinstance
(
other
,
StringType
):
other
=
StrictVersion
(
other
)
if
isinstance
(
other
,
StringType
):
other
=
StrictVersion
(
other
)
compare
=
cmp
(
self
.
version
,
other
.
version
)
compare
=
cmp
(
self
.
version
,
other
.
version
)
if
(
compare
==
0
):
# have to compare prerelease
# case 1: neither has prerelease; they're equal
...
...
@@ -154,7 +154,7 @@ class StrictVersion (Version):
elif
(
not
self
.
prerelease
and
other
.
prerelease
):
return
1
elif
(
self
.
prerelease
and
other
.
prerelease
):
return
cmp
(
self
.
prerelease
,
other
.
prerelease
)
return
cmp
(
self
.
prerelease
,
other
.
prerelease
)
else
:
# numeric versions don't match --
return
compare
# prerelease stuff doesn't matter
...
...
@@ -264,7 +264,7 @@ class LooseVersion (Version):
def
__init__
(
self
,
vstring
=
None
):
if
vstring
:
self
.
parse
(
vstring
)
self
.
parse
(
vstring
)
def
parse
(
self
,
vstring
):
...
...
@@ -272,11 +272,11 @@ class LooseVersion (Version):
# from the parsed tuple -- so I just store the string here for
# use by __str__
self
.
vstring
=
vstring
components
=
filter
(
lambda
x
:
x
and
x
!=
'.'
,
self
.
component_re
.
split
(
vstring
))
for
i
in
range
(
len
(
components
)):
components
=
filter
(
lambda
x
:
x
and
x
!=
'.'
,
self
.
component_re
.
split
(
vstring
))
for
i
in
range
(
len
(
components
)):
try
:
components
[
i
]
=
int
(
components
[
i
])
components
[
i
]
=
int
(
components
[
i
])
except
ValueError
:
pass
...
...
@@ -288,14 +288,14 @@ class LooseVersion (Version):
def
__repr__
(
self
):
return
"LooseVersion ('
%
s')"
%
str
(
self
)
return
"LooseVersion ('
%
s')"
%
str
(
self
)
def
__cmp__
(
self
,
other
):
if
isinstance
(
other
,
StringType
):
other
=
LooseVersion
(
other
)
if
isinstance
(
other
,
StringType
):
other
=
LooseVersion
(
other
)
return
cmp
(
self
.
version
,
other
.
version
)
return
cmp
(
self
.
version
,
other
.
version
)
# end class LooseVersion
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