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
cc95dd81
Kaydet (Commit)
cc95dd81
authored
Eyl 18, 2011
tarafından
Éric Araujo
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Branch merge
üst
229011d9
0cfb81d1
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
47 additions
and
96 deletions
+47
-96
build_ext.py
Lib/packaging/command/build_ext.py
+6
-11
build_py.py
Lib/packaging/command/build_py.py
+1
-1
install_dist.py
Lib/packaging/command/install_dist.py
+21
-38
install_distinfo.py
Lib/packaging/command/install_distinfo.py
+3
-4
install_lib.py
Lib/packaging/command/install_lib.py
+1
-1
bcppcompiler.py
Lib/packaging/compiler/bcppcompiler.py
+0
-1
ccompiler.py
Lib/packaging/compiler/ccompiler.py
+0
-1
dist.py
Lib/packaging/dist.py
+2
-2
test_command_build_ext.py
Lib/packaging/tests/test_command_build_ext.py
+1
-7
test_command_build_py.py
Lib/packaging/tests/test_command_build_py.py
+0
-2
test_command_install_dist.py
Lib/packaging/tests/test_command_install_dist.py
+5
-7
test_command_install_lib.py
Lib/packaging/tests/test_command_install_lib.py
+1
-10
test_mixin2to3.py
Lib/packaging/tests/test_mixin2to3.py
+0
-3
test_util.py
Lib/packaging/tests/test_util.py
+0
-4
util.py
Lib/packaging/util.py
+4
-2
pkgutil.py
Lib/pkgutil.py
+2
-2
No files found.
Lib/packaging/command/build_ext.py
Dosyayı görüntüle @
cc95dd81
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
import
os
import
os
import
re
import
re
import
sys
import
sys
import
site
import
logging
import
logging
import
sysconfig
import
sysconfig
...
@@ -15,9 +16,6 @@ from packaging.util import newer_group
...
@@ -15,9 +16,6 @@ from packaging.util import newer_group
from
packaging.compiler.extension
import
Extension
from
packaging.compiler.extension
import
Extension
from
packaging
import
logger
from
packaging
import
logger
import
site
HAS_USER_SITE
=
True
if
os
.
name
==
'nt'
:
if
os
.
name
==
'nt'
:
from
packaging.compiler.msvccompiler
import
get_build_version
from
packaging.compiler.msvccompiler
import
get_build_version
MSVC_VERSION
=
int
(
get_build_version
())
MSVC_VERSION
=
int
(
get_build_version
())
...
@@ -62,6 +60,8 @@ class build_ext(Command):
...
@@ -62,6 +60,8 @@ class build_ext(Command):
(
'inplace'
,
'i'
,
(
'inplace'
,
'i'
,
"ignore build-lib and put compiled extensions into the source "
+
"ignore build-lib and put compiled extensions into the source "
+
"directory alongside your pure Python modules"
),
"directory alongside your pure Python modules"
),
(
'user'
,
None
,
"add user include, library and rpath"
),
(
'include-dirs='
,
'I'
,
(
'include-dirs='
,
'I'
,
"list of directories to search for header files"
+
sep_by
),
"list of directories to search for header files"
+
sep_by
),
(
'define='
,
'D'
,
(
'define='
,
'D'
,
...
@@ -88,12 +88,8 @@ class build_ext(Command):
...
@@ -88,12 +88,8 @@ class build_ext(Command):
"path to the SWIG executable"
),
"path to the SWIG executable"
),
]
]
boolean_options
=
[
'inplace'
,
'debug'
,
'force'
]
boolean_options
=
[
'inplace'
,
'debug'
,
'force'
,
'user'
]
if
HAS_USER_SITE
:
user_options
.
append
((
'user'
,
None
,
"add user include, library and rpath"
))
boolean_options
.
append
(
'user'
)
help_options
=
[
help_options
=
[
(
'help-compiler'
,
None
,
(
'help-compiler'
,
None
,
...
@@ -120,8 +116,7 @@ class build_ext(Command):
...
@@ -120,8 +116,7 @@ class build_ext(Command):
self
.
compiler
=
None
self
.
compiler
=
None
self
.
swig
=
None
self
.
swig
=
None
self
.
swig_opts
=
None
self
.
swig_opts
=
None
if
HAS_USER_SITE
:
self
.
user
=
None
self
.
user
=
None
def
finalize_options
(
self
):
def
finalize_options
(
self
):
self
.
set_undefined_options
(
'build'
,
self
.
set_undefined_options
(
'build'
,
...
@@ -270,7 +265,7 @@ class build_ext(Command):
...
@@ -270,7 +265,7 @@ class build_ext(Command):
self
.
swig_opts
=
self
.
swig_opts
.
split
(
' '
)
self
.
swig_opts
=
self
.
swig_opts
.
split
(
' '
)
# Finally add the user include and library directories if requested
# Finally add the user include and library directories if requested
if
HAS_USER_SITE
and
self
.
user
:
if
self
.
user
:
user_include
=
os
.
path
.
join
(
site
.
USER_BASE
,
"include"
)
user_include
=
os
.
path
.
join
(
site
.
USER_BASE
,
"include"
)
user_lib
=
os
.
path
.
join
(
site
.
USER_BASE
,
"lib"
)
user_lib
=
os
.
path
.
join
(
site
.
USER_BASE
,
"lib"
)
if
os
.
path
.
isdir
(
user_include
):
if
os
.
path
.
isdir
(
user_include
):
...
...
Lib/packaging/command/build_py.py
Dosyayı görüntüle @
cc95dd81
...
@@ -388,7 +388,7 @@ class build_py(Command, Mixin2to3):
...
@@ -388,7 +388,7 @@ class build_py(Command, Mixin2to3):
self
.
build_module
(
module
,
module_file
,
package
)
self
.
build_module
(
module
,
module_file
,
package
)
def
byte_compile
(
self
,
files
):
def
byte_compile
(
self
,
files
):
if
hasattr
(
sys
,
'dont_write_bytecode'
)
and
sys
.
dont_write_bytecode
:
if
sys
.
dont_write_bytecode
:
logger
.
warning
(
'
%
s: byte-compiling is disabled, skipping.'
,
logger
.
warning
(
'
%
s: byte-compiling is disabled, skipping.'
,
self
.
get_command_name
())
self
.
get_command_name
())
return
return
...
...
Lib/packaging/command/install_dist.py
Dosyayı görüntüle @
cc95dd81
...
@@ -14,9 +14,6 @@ from packaging.util import convert_path, change_root, get_platform
...
@@ -14,9 +14,6 @@ from packaging.util import convert_path, change_root, get_platform
from
packaging.errors
import
PackagingOptionError
from
packaging.errors
import
PackagingOptionError
HAS_USER_SITE
=
True
class
install_dist
(
Command
):
class
install_dist
(
Command
):
description
=
"install everything from build directory"
description
=
"install everything from build directory"
...
@@ -27,6 +24,9 @@ class install_dist(Command):
...
@@ -27,6 +24,9 @@ class install_dist(Command):
"installation prefix"
),
"installation prefix"
),
(
'exec-prefix='
,
None
,
(
'exec-prefix='
,
None
,
"(Unix only) prefix for platform-specific files"
),
"(Unix only) prefix for platform-specific files"
),
(
'user'
,
None
,
"install in user site-packages directory [
%
s]"
%
get_path
(
'purelib'
,
'
%
s_user'
%
os
.
name
)),
(
'home='
,
None
,
(
'home='
,
None
,
"(Unix only) home directory to install under"
),
"(Unix only) home directory to install under"
),
...
@@ -97,15 +97,7 @@ class install_dist(Command):
...
@@ -97,15 +97,7 @@ class install_dist(Command):
]
]
boolean_options
=
[
'compile'
,
'force'
,
'skip-build'
,
'no-distinfo'
,
boolean_options
=
[
'compile'
,
'force'
,
'skip-build'
,
'no-distinfo'
,
'requested'
,
'no-record'
]
'requested'
,
'no-record'
,
'user'
]
if
HAS_USER_SITE
:
user_options
.
append
(
(
'user'
,
None
,
"install in user site-packages directory [
%
s]"
%
get_path
(
'purelib'
,
'
%
s_user'
%
os
.
name
)))
boolean_options
.
append
(
'user'
)
negative_opt
=
{
'no-compile'
:
'compile'
,
'no-requested'
:
'requested'
}
negative_opt
=
{
'no-compile'
:
'compile'
,
'no-requested'
:
'requested'
}
...
@@ -115,8 +107,7 @@ class install_dist(Command):
...
@@ -115,8 +107,7 @@ class install_dist(Command):
self
.
prefix
=
None
self
.
prefix
=
None
self
.
exec_prefix
=
None
self
.
exec_prefix
=
None
self
.
home
=
None
self
.
home
=
None
if
HAS_USER_SITE
:
self
.
user
=
False
self
.
user
=
False
# These select only the installation base; it's up to the user to
# These select only the installation base; it's up to the user to
# specify the installation scheme (currently, that means supplying
# specify the installation scheme (currently, that means supplying
...
@@ -135,9 +126,8 @@ class install_dist(Command):
...
@@ -135,9 +126,8 @@ class install_dist(Command):
self
.
install_lib
=
None
# set to either purelib or platlib
self
.
install_lib
=
None
# set to either purelib or platlib
self
.
install_scripts
=
None
self
.
install_scripts
=
None
self
.
install_data
=
None
self
.
install_data
=
None
if
HAS_USER_SITE
:
self
.
install_userbase
=
get_config_var
(
'userbase'
)
self
.
install_userbase
=
get_config_var
(
'userbase'
)
self
.
install_usersite
=
get_path
(
'purelib'
,
'
%
s_user'
%
os
.
name
)
self
.
install_usersite
=
get_path
(
'purelib'
,
'
%
s_user'
%
os
.
name
)
self
.
compile
=
None
self
.
compile
=
None
self
.
optimize
=
None
self
.
optimize
=
None
...
@@ -219,9 +209,8 @@ class install_dist(Command):
...
@@ -219,9 +209,8 @@ class install_dist(Command):
raise
PackagingOptionError
(
raise
PackagingOptionError
(
"must supply either home or prefix/exec-prefix -- not both"
)
"must supply either home or prefix/exec-prefix -- not both"
)
if
HAS_USER_SITE
and
self
.
user
and
(
if
self
.
user
and
(
self
.
prefix
or
self
.
exec_prefix
or
self
.
home
or
self
.
prefix
or
self
.
exec_prefix
or
self
.
home
or
self
.
install_base
or
self
.
install_platbase
):
self
.
install_base
or
self
.
install_platbase
):
raise
PackagingOptionError
(
raise
PackagingOptionError
(
"can't combine user with prefix/exec_prefix/home or "
"can't combine user with prefix/exec_prefix/home or "
"install_base/install_platbase"
)
"install_base/install_platbase"
)
...
@@ -274,11 +263,9 @@ class install_dist(Command):
...
@@ -274,11 +263,9 @@ class install_dist(Command):
'exec_prefix'
:
exec_prefix
,
'exec_prefix'
:
exec_prefix
,
'srcdir'
:
srcdir
,
'srcdir'
:
srcdir
,
'projectbase'
:
projectbase
,
'projectbase'
:
projectbase
,
}
'userbase'
:
self
.
install_userbase
,
'usersite'
:
self
.
install_usersite
,
if
HAS_USER_SITE
:
}
self
.
config_vars
[
'userbase'
]
=
self
.
install_userbase
self
.
config_vars
[
'usersite'
]
=
self
.
install_usersite
self
.
expand_basedirs
()
self
.
expand_basedirs
()
...
@@ -295,9 +282,9 @@ class install_dist(Command):
...
@@ -295,9 +282,9 @@ class install_dist(Command):
self
.
dump_dirs
(
"post-expand_dirs()"
)
self
.
dump_dirs
(
"post-expand_dirs()"
)
# Create directories
in the home dir:
# Create directories
under USERBASE
if
HAS_USER_SITE
and
self
.
user
:
if
self
.
user
:
self
.
create_
home_path
()
self
.
create_
user_dirs
()
# Pick the actual directory to install all modules to: either
# Pick the actual directory to install all modules to: either
# install_purelib or install_platlib, depending on whether this
# install_purelib or install_platlib, depending on whether this
...
@@ -311,10 +298,8 @@ class install_dist(Command):
...
@@ -311,10 +298,8 @@ class install_dist(Command):
# Convert directories from Unix /-separated syntax to the local
# Convert directories from Unix /-separated syntax to the local
# convention.
# convention.
self
.
convert_paths
(
'lib'
,
'purelib'
,
'platlib'
,
self
.
convert_paths
(
'lib'
,
'purelib'
,
'platlib'
,
'scripts'
,
'scripts'
,
'data'
,
'headers'
)
'data'
,
'headers'
,
'userbase'
,
'usersite'
)
if
HAS_USER_SITE
:
self
.
convert_paths
(
'userbase'
,
'usersite'
)
# Well, we're not actually fully completely finalized yet: we still
# Well, we're not actually fully completely finalized yet: we still
# have to deal with 'extra_path', which is the hack for allowing
# have to deal with 'extra_path', which is the hack for allowing
...
@@ -355,7 +340,7 @@ class install_dist(Command):
...
@@ -355,7 +340,7 @@ class install_dist(Command):
"installation scheme is incomplete"
)
"installation scheme is incomplete"
)
return
return
if
HAS_USER_SITE
and
self
.
user
:
if
self
.
user
:
if
self
.
install_userbase
is
None
:
if
self
.
install_userbase
is
None
:
raise
PackagingPlatformError
(
raise
PackagingPlatformError
(
"user base directory is not specified"
)
"user base directory is not specified"
)
...
@@ -383,7 +368,7 @@ class install_dist(Command):
...
@@ -383,7 +368,7 @@ class install_dist(Command):
def
finalize_other
(
self
):
def
finalize_other
(
self
):
"""Finalize options for non-posix platforms"""
"""Finalize options for non-posix platforms"""
if
HAS_USER_SITE
and
self
.
user
:
if
self
.
user
:
if
self
.
install_userbase
is
None
:
if
self
.
install_userbase
is
None
:
raise
PackagingPlatformError
(
raise
PackagingPlatformError
(
"user base directory is not specified"
)
"user base directory is not specified"
)
...
@@ -494,10 +479,8 @@ class install_dist(Command):
...
@@ -494,10 +479,8 @@ class install_dist(Command):
attr
=
"install_"
+
name
attr
=
"install_"
+
name
setattr
(
self
,
attr
,
change_root
(
self
.
root
,
getattr
(
self
,
attr
)))
setattr
(
self
,
attr
,
change_root
(
self
.
root
,
getattr
(
self
,
attr
)))
def
create_home_path
(
self
):
def
create_user_dirs
(
self
):
"""Create directories under ~."""
"""Create directories under USERBASE as needed."""
if
HAS_USER_SITE
and
not
self
.
user
:
return
home
=
convert_path
(
os
.
path
.
expanduser
(
"~"
))
home
=
convert_path
(
os
.
path
.
expanduser
(
"~"
))
for
name
,
path
in
self
.
config_vars
.
items
():
for
name
,
path
in
self
.
config_vars
.
items
():
if
path
.
startswith
(
home
)
and
not
os
.
path
.
isdir
(
path
):
if
path
.
startswith
(
home
)
and
not
os
.
path
.
isdir
(
path
):
...
...
Lib/packaging/command/install_distinfo.py
Dosyayı görüntüle @
cc95dd81
...
@@ -2,14 +2,13 @@
...
@@ -2,14 +2,13 @@
# Forked from the former install_egg_info command by Josip Djolonga
# Forked from the former install_egg_info command by Josip Djolonga
import
csv
import
os
import
os
import
re
import
csv
import
hashlib
import
hashlib
from
shutil
import
rmtree
from
packaging.command.cmd
import
Command
from
packaging
import
logger
from
packaging
import
logger
from
shutil
import
rmtree
from
packaging.command.cmd
import
Command
class
install_distinfo
(
Command
):
class
install_distinfo
(
Command
):
...
...
Lib/packaging/command/install_lib.py
Dosyayı görüntüle @
cc95dd81
...
@@ -114,7 +114,7 @@ class install_lib(Command):
...
@@ -114,7 +114,7 @@ class install_lib(Command):
return
outfiles
return
outfiles
def
byte_compile
(
self
,
files
):
def
byte_compile
(
self
,
files
):
if
getattr
(
sys
,
'dont_write_bytecode'
)
:
if
sys
.
dont_write_bytecode
:
# XXX do we want this? because a Python runs without bytecode
# XXX do we want this? because a Python runs without bytecode
# doesn't mean that the *dists should not contain bytecode
# doesn't mean that the *dists should not contain bytecode
#--or does it?
#--or does it?
...
...
Lib/packaging/compiler/bcppcompiler.py
Dosyayı görüntüle @
cc95dd81
...
@@ -352,5 +352,4 @@ class BCPPCompiler(CCompiler) :
...
@@ -352,5 +352,4 @@ class BCPPCompiler(CCompiler) :
try
:
try
:
self
.
spawn
(
pp_args
)
self
.
spawn
(
pp_args
)
except
PackagingExecError
as
msg
:
except
PackagingExecError
as
msg
:
print
(
msg
)
raise
CompileError
(
msg
)
raise
CompileError
(
msg
)
Lib/packaging/compiler/ccompiler.py
Dosyayı görüntüle @
cc95dd81
...
@@ -5,7 +5,6 @@ interface for the compiler abstraction model used by packaging.
...
@@ -5,7 +5,6 @@ interface for the compiler abstraction model used by packaging.
"""
"""
import
os
import
os
import
sys
from
shutil
import
move
from
shutil
import
move
from
packaging
import
logger
from
packaging
import
logger
from
packaging.util
import
split_quoted
,
execute
,
newer_group
,
spawn
from
packaging.util
import
split_quoted
,
execute
,
newer_group
,
spawn
...
...
Lib/packaging/dist.py
Dosyayı görüntüle @
cc95dd81
...
@@ -537,7 +537,7 @@ Common commands: (see '--help-commands' for more)
...
@@ -537,7 +537,7 @@ Common commands: (see '--help-commands' for more)
def
_get_command_groups
(
self
):
def
_get_command_groups
(
self
):
"""Helper function to retrieve all the command class names divided
"""Helper function to retrieve all the command class names divided
into standard commands (listed in
into standard commands (listed in
packaging
2
.command.STANDARD_COMMANDS) and extra commands (given in
packaging.command.STANDARD_COMMANDS) and extra commands (given in
self.cmdclass and not standard commands).
self.cmdclass and not standard commands).
"""
"""
extra_commands
=
[
cmd
for
cmd
in
self
.
cmdclass
extra_commands
=
[
cmd
for
cmd
in
self
.
cmdclass
...
@@ -547,7 +547,7 @@ Common commands: (see '--help-commands' for more)
...
@@ -547,7 +547,7 @@ Common commands: (see '--help-commands' for more)
def
print_commands
(
self
):
def
print_commands
(
self
):
"""Print out a help message listing all available commands with a
"""Print out a help message listing all available commands with a
description of each. The list is divided into standard commands
description of each. The list is divided into standard commands
(listed in packaging
2
.command.STANDARD_COMMANDS) and extra commands
(listed in packaging.command.STANDARD_COMMANDS) and extra commands
(given in self.cmdclass and not standard commands). The
(given in self.cmdclass and not standard commands). The
descriptions come from the command class attribute
descriptions come from the command class attribute
'description'.
'description'.
...
...
Lib/packaging/tests/test_command_build_ext.py
Dosyayı görüntüle @
cc95dd81
...
@@ -19,18 +19,13 @@ class BuildExtTestCase(support.TempdirManager,
...
@@ -19,18 +19,13 @@ class BuildExtTestCase(support.TempdirManager,
support
.
LoggingCatcher
,
support
.
LoggingCatcher
,
unittest
.
TestCase
):
unittest
.
TestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
# Create a simple test environment
# Note that we're making changes to sys.path
super
(
BuildExtTestCase
,
self
)
.
setUp
()
super
(
BuildExtTestCase
,
self
)
.
setUp
()
self
.
tmp_dir
=
self
.
mkdtemp
()
self
.
tmp_dir
=
self
.
mkdtemp
()
self
.
old_user_base
=
site
.
USER_BASE
self
.
old_user_base
=
site
.
USER_BASE
site
.
USER_BASE
=
self
.
mkdtemp
()
site
.
USER_BASE
=
self
.
mkdtemp
()
def
tearDown
(
self
):
def
tearDown
(
self
):
# Get everything back to normal
site
.
USER_BASE
=
self
.
old_user_base
if
sys
.
version
>
"2.6"
:
site
.
USER_BASE
=
self
.
old_user_base
super
(
BuildExtTestCase
,
self
)
.
tearDown
()
super
(
BuildExtTestCase
,
self
)
.
tearDown
()
def
test_build_ext
(
self
):
def
test_build_ext
(
self
):
...
@@ -94,7 +89,6 @@ class BuildExtTestCase(support.TempdirManager,
...
@@ -94,7 +89,6 @@ class BuildExtTestCase(support.TempdirManager,
# make sure we get some library dirs under solaris
# make sure we get some library dirs under solaris
self
.
assertGreater
(
len
(
cmd
.
library_dirs
),
0
)
self
.
assertGreater
(
len
(
cmd
.
library_dirs
),
0
)
@unittest.skipIf
(
sys
.
version
<
'2.6'
,
'requires Python 2.6 or higher'
)
def
test_user_site
(
self
):
def
test_user_site
(
self
):
dist
=
Distribution
({
'name'
:
'xx'
})
dist
=
Distribution
({
'name'
:
'xx'
})
cmd
=
build_ext
(
dist
)
cmd
=
build_ext
(
dist
)
...
...
Lib/packaging/tests/test_command_build_py.py
Dosyayı görüntüle @
cc95dd81
...
@@ -99,8 +99,6 @@ class BuildPyTestCase(support.TempdirManager,
...
@@ -99,8 +99,6 @@ class BuildPyTestCase(support.TempdirManager,
os
.
chdir
(
cwd
)
os
.
chdir
(
cwd
)
sys
.
stdout
=
old_stdout
sys
.
stdout
=
old_stdout
@unittest.skipUnless
(
hasattr
(
sys
,
'dont_write_bytecode'
),
'sys.dont_write_bytecode not supported'
)
def
test_dont_write_bytecode
(
self
):
def
test_dont_write_bytecode
(
self
):
# makes sure byte_compile is not used
# makes sure byte_compile is not used
pkg_dir
,
dist
=
self
.
create_dist
()
pkg_dir
,
dist
=
self
.
create_dist
()
...
...
Lib/packaging/tests/test_command_install_dist.py
Dosyayı görüntüle @
cc95dd81
...
@@ -72,7 +72,6 @@ class InstallTestCase(support.TempdirManager,
...
@@ -72,7 +72,6 @@ class InstallTestCase(support.TempdirManager,
check_path
(
cmd
.
install_scripts
,
os
.
path
.
join
(
destination
,
"bin"
))
check_path
(
cmd
.
install_scripts
,
os
.
path
.
join
(
destination
,
"bin"
))
check_path
(
cmd
.
install_data
,
destination
)
check_path
(
cmd
.
install_data
,
destination
)
@unittest.skipIf
(
sys
.
version
<
'2.6'
,
'requires Python 2.6 or higher'
)
def
test_user_site
(
self
):
def
test_user_site
(
self
):
# test install with --user
# test install with --user
# preparing the environment for the test
# preparing the environment for the test
...
@@ -173,12 +172,11 @@ class InstallTestCase(support.TempdirManager,
...
@@ -173,12 +172,11 @@ class InstallTestCase(support.TempdirManager,
cmd
.
home
=
'home'
cmd
.
home
=
'home'
self
.
assertRaises
(
PackagingOptionError
,
cmd
.
finalize_options
)
self
.
assertRaises
(
PackagingOptionError
,
cmd
.
finalize_options
)
if
sys
.
version
>=
'2.6'
:
# can't combine user with with prefix/exec_prefix/home or
# can't combine user with with prefix/exec_prefix/home or
# install_(plat)base
# install_(plat)base
cmd
.
prefix
=
None
cmd
.
prefix
=
None
cmd
.
user
=
'user'
cmd
.
user
=
'user'
self
.
assertRaises
(
PackagingOptionError
,
cmd
.
finalize_options
)
self
.
assertRaises
(
PackagingOptionError
,
cmd
.
finalize_options
)
def
test_old_record
(
self
):
def
test_old_record
(
self
):
# test pre-PEP 376 --record option (outside dist-info dir)
# test pre-PEP 376 --record option (outside dist-info dir)
...
...
Lib/packaging/tests/test_command_install_lib.py
Dosyayı görüntüle @
cc95dd81
...
@@ -7,13 +7,6 @@ from packaging.command.install_lib import install_lib
...
@@ -7,13 +7,6 @@ from packaging.command.install_lib import install_lib
from
packaging.compiler.extension
import
Extension
from
packaging.compiler.extension
import
Extension
from
packaging.errors
import
PackagingOptionError
from
packaging.errors
import
PackagingOptionError
try
:
no_bytecode
=
sys
.
dont_write_bytecode
bytecode_support
=
True
except
AttributeError
:
no_bytecode
=
False
bytecode_support
=
False
class
InstallLibTestCase
(
support
.
TempdirManager
,
class
InstallLibTestCase
(
support
.
TempdirManager
,
support
.
LoggingCatcher
,
support
.
LoggingCatcher
,
...
@@ -40,7 +33,7 @@ class InstallLibTestCase(support.TempdirManager,
...
@@ -40,7 +33,7 @@ class InstallLibTestCase(support.TempdirManager,
cmd
.
finalize_options
()
cmd
.
finalize_options
()
self
.
assertEqual
(
cmd
.
optimize
,
2
)
self
.
assertEqual
(
cmd
.
optimize
,
2
)
@unittest.skipIf
(
no
_bytecode
,
'byte-compile disabled'
)
@unittest.skipIf
(
sys
.
dont_write
_bytecode
,
'byte-compile disabled'
)
def
test_byte_compile
(
self
):
def
test_byte_compile
(
self
):
pkg_dir
,
dist
=
self
.
create_dist
()
pkg_dir
,
dist
=
self
.
create_dist
()
cmd
=
install_lib
(
dist
)
cmd
=
install_lib
(
dist
)
...
@@ -89,8 +82,6 @@ class InstallLibTestCase(support.TempdirManager,
...
@@ -89,8 +82,6 @@ class InstallLibTestCase(support.TempdirManager,
# get_input should return 2 elements
# get_input should return 2 elements
self
.
assertEqual
(
len
(
cmd
.
get_inputs
()),
2
)
self
.
assertEqual
(
len
(
cmd
.
get_inputs
()),
2
)
@unittest.skipUnless
(
bytecode_support
,
'sys.dont_write_bytecode not supported'
)
def
test_dont_write_bytecode
(
self
):
def
test_dont_write_bytecode
(
self
):
# makes sure byte_compile is not used
# makes sure byte_compile is not used
pkg_dir
,
dist
=
self
.
create_dist
()
pkg_dir
,
dist
=
self
.
create_dist
()
...
...
Lib/packaging/tests/test_mixin2to3.py
Dosyayı görüntüle @
cc95dd81
...
@@ -9,7 +9,6 @@ class Mixin2to3TestCase(support.TempdirManager,
...
@@ -9,7 +9,6 @@ class Mixin2to3TestCase(support.TempdirManager,
support
.
LoggingCatcher
,
support
.
LoggingCatcher
,
unittest
.
TestCase
):
unittest
.
TestCase
):
@unittest.skipIf
(
sys
.
version
<
'2.6'
,
'requires Python 2.6 or higher'
)
def
test_convert_code_only
(
self
):
def
test_convert_code_only
(
self
):
# used to check if code gets converted properly.
# used to check if code gets converted properly.
code
=
"print 'test'"
code
=
"print 'test'"
...
@@ -26,7 +25,6 @@ class Mixin2to3TestCase(support.TempdirManager,
...
@@ -26,7 +25,6 @@ class Mixin2to3TestCase(support.TempdirManager,
self
.
assertEqual
(
expected
,
converted
)
self
.
assertEqual
(
expected
,
converted
)
@unittest.skipIf
(
sys
.
version
<
'2.6'
,
'requires Python 2.6 or higher'
)
def
test_doctests_only
(
self
):
def
test_doctests_only
(
self
):
# used to check if doctests gets converted properly.
# used to check if doctests gets converted properly.
doctest
=
textwrap
.
dedent
(
'''
\
doctest
=
textwrap
.
dedent
(
'''
\
...
@@ -57,7 +55,6 @@ class Mixin2to3TestCase(support.TempdirManager,
...
@@ -57,7 +55,6 @@ class Mixin2to3TestCase(support.TempdirManager,
self
.
assertEqual
(
expected
,
converted
)
self
.
assertEqual
(
expected
,
converted
)
@unittest.skipIf
(
sys
.
version
<
'2.6'
,
'requires Python 2.6 or higher'
)
def
test_additional_fixers
(
self
):
def
test_additional_fixers
(
self
):
# used to check if use_2to3_fixers works
# used to check if use_2to3_fixers works
code
=
'type(x) is not T'
code
=
'type(x) is not T'
...
...
Lib/packaging/tests/test_util.py
Dosyayı görüntüle @
cc95dd81
...
@@ -319,8 +319,6 @@ class UtilTestCase(support.EnvironRestorer,
...
@@ -319,8 +319,6 @@ class UtilTestCase(support.EnvironRestorer,
res
=
get_compiler_versions
()
res
=
get_compiler_versions
()
self
.
assertEqual
(
res
[
2
],
None
)
self
.
assertEqual
(
res
[
2
],
None
)
@unittest.skipUnless
(
hasattr
(
sys
,
'dont_write_bytecode'
),
'sys.dont_write_bytecode not supported'
)
def
test_dont_write_bytecode
(
self
):
def
test_dont_write_bytecode
(
self
):
# makes sure byte_compile raise a PackagingError
# makes sure byte_compile raise a PackagingError
# if sys.dont_write_bytecode is True
# if sys.dont_write_bytecode is True
...
@@ -407,7 +405,6 @@ class UtilTestCase(support.EnvironRestorer,
...
@@ -407,7 +405,6 @@ class UtilTestCase(support.EnvironRestorer,
finally
:
finally
:
sys
.
path
.
remove
(
tmp_dir
)
sys
.
path
.
remove
(
tmp_dir
)
@unittest.skipIf
(
sys
.
version
<
'2.6'
,
'requires Python 2.6 or higher'
)
def
test_run_2to3_on_code
(
self
):
def
test_run_2to3_on_code
(
self
):
content
=
"print 'test'"
content
=
"print 'test'"
converted_content
=
"print('test')"
converted_content
=
"print('test')"
...
@@ -421,7 +418,6 @@ class UtilTestCase(support.EnvironRestorer,
...
@@ -421,7 +418,6 @@ class UtilTestCase(support.EnvironRestorer,
file_handle
.
close
()
file_handle
.
close
()
self
.
assertEqual
(
new_content
,
converted_content
)
self
.
assertEqual
(
new_content
,
converted_content
)
@unittest.skipIf
(
sys
.
version
<
'2.6'
,
'requires Python 2.6 or higher'
)
def
test_run_2to3_on_doctests
(
self
):
def
test_run_2to3_on_doctests
(
self
):
# to check if text files containing doctests only get converted.
# to check if text files containing doctests only get converted.
content
=
">>> print 'test'
\n
test
\n
"
content
=
">>> print 'test'
\n
test
\n
"
...
...
Lib/packaging/util.py
Dosyayı görüntüle @
cc95dd81
...
@@ -326,7 +326,7 @@ def byte_compile(py_files, optimize=0, force=False, prefix=None,
...
@@ -326,7 +326,7 @@ def byte_compile(py_files, optimize=0, force=False, prefix=None,
"""
"""
# nothing is done if sys.dont_write_bytecode is True
# nothing is done if sys.dont_write_bytecode is True
# FIXME this should not raise an error
# FIXME this should not raise an error
if
hasattr
(
sys
,
'dont_write_bytecode'
)
and
sys
.
dont_write_bytecode
:
if
sys
.
dont_write_bytecode
:
raise
PackagingByteCompileError
(
'byte-compiling is disabled.'
)
raise
PackagingByteCompileError
(
'byte-compiling is disabled.'
)
# First, if the caller didn't force us into direct or indirect mode,
# First, if the caller didn't force us into direct or indirect mode,
...
@@ -346,8 +346,10 @@ def byte_compile(py_files, optimize=0, force=False, prefix=None,
...
@@ -346,8 +346,10 @@ def byte_compile(py_files, optimize=0, force=False, prefix=None,
# run it with the appropriate flags.
# run it with the appropriate flags.
if
not
direct
:
if
not
direct
:
from
tempfile
import
mkstemp
from
tempfile
import
mkstemp
# XXX
script_fd may leak,
use something better than mkstemp
# XXX use something better than mkstemp
script_fd
,
script_name
=
mkstemp
(
".py"
)
script_fd
,
script_name
=
mkstemp
(
".py"
)
os
.
close
(
script_fd
)
script_fd
=
None
logger
.
info
(
"writing byte-compilation script '
%
s'"
,
script_name
)
logger
.
info
(
"writing byte-compilation script '
%
s'"
,
script_name
)
if
not
dry_run
:
if
not
dry_run
:
if
script_fd
is
not
None
:
if
script_fd
is
not
None
:
...
...
Lib/pkgutil.py
Dosyayı görüntüle @
cc95dd81
...
@@ -307,9 +307,9 @@ class ImpLoader:
...
@@ -307,9 +307,9 @@ class ImpLoader:
def
get_filename
(
self
,
fullname
=
None
):
def
get_filename
(
self
,
fullname
=
None
):
fullname
=
self
.
_fix_name
(
fullname
)
fullname
=
self
.
_fix_name
(
fullname
)
mod_type
=
self
.
etc
[
2
]
mod_type
=
self
.
etc
[
2
]
if
self
.
etc
[
2
]
==
imp
.
PKG_DIRECTORY
:
if
mod_type
==
imp
.
PKG_DIRECTORY
:
return
self
.
_get_delegate
()
.
get_filename
()
return
self
.
_get_delegate
()
.
get_filename
()
elif
self
.
etc
[
2
]
in
(
imp
.
PY_SOURCE
,
imp
.
PY_COMPILED
,
imp
.
C_EXTENSION
):
elif
mod_type
in
(
imp
.
PY_SOURCE
,
imp
.
PY_COMPILED
,
imp
.
C_EXTENSION
):
return
self
.
filename
return
self
.
filename
return
None
return
None
...
...
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