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
344ff4ab
Kaydet (Commit)
344ff4ab
authored
Agu 19, 2014
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
allow recursion depth to be specified (closes #19628)
Patch from Claudiu Popa.
üst
54b3b3fb
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
59 additions
and
1 deletion
+59
-1
compileall.rst
Doc/library/compileall.rst
+11
-0
compileall.py
Lib/compileall.py
+11
-1
test_compileall.py
Lib/test/test_compileall.py
+34
-0
NEWS
Misc/NEWS
+3
-0
No files found.
Doc/library/compileall.rst
Dosyayı görüntüle @
344ff4ab
...
@@ -66,9 +66,20 @@ compile Python sources.
...
@@ -66,9 +66,20 @@ compile Python sources.
is to write files to their :pep:`3147` locations and names, which allows
is to write files to their :pep:`3147` locations and names, which allows
byte-code files from multiple versions of Python to coexist.
byte-code files from multiple versions of Python to coexist.
.. cmdoption:: -r
Control the maximum recursion level for subdirectories.
If this is given, then ``-l`` option will not be taken into account.
:program:`python -m compileall <directory> -r 0` is equivalent to
:program:`python -m compileall <directory> -l`.
.. versionchanged:: 3.2
.. versionchanged:: 3.2
Added the ``-i``, ``-b`` and ``-h`` options.
Added the ``-i``, ``-b`` and ``-h`` options.
.. versionchanged:: 3.5
Added the ``-r`` option.
There is no command-line option to control the optimization level used by the
There is no command-line option to control the optimization level used by the
:func:`compile` function, because the Python interpreter itself already
:func:`compile` function, because the Python interpreter itself already
provides the option: :program:`python -O -m compileall`.
provides the option: :program:`python -O -m compileall`.
...
...
Lib/compileall.py
Dosyayı görüntüle @
344ff4ab
...
@@ -169,6 +169,10 @@ def main():
...
@@ -169,6 +169,10 @@ def main():
parser
.
add_argument
(
'-l'
,
action
=
'store_const'
,
const
=
0
,
parser
.
add_argument
(
'-l'
,
action
=
'store_const'
,
const
=
0
,
default
=
10
,
dest
=
'maxlevels'
,
default
=
10
,
dest
=
'maxlevels'
,
help
=
"don't recurse into subdirectories"
)
help
=
"don't recurse into subdirectories"
)
parser
.
add_argument
(
'-r'
,
type
=
int
,
dest
=
'recursion'
,
help
=
(
'control the maximum recursion level. '
'if `-l` and `-r` options are specified, '
'then `-r` takes precedence.'
))
parser
.
add_argument
(
'-f'
,
action
=
'store_true'
,
dest
=
'force'
,
parser
.
add_argument
(
'-f'
,
action
=
'store_true'
,
dest
=
'force'
,
help
=
'force rebuild even if timestamps are up to date'
)
help
=
'force rebuild even if timestamps are up to date'
)
parser
.
add_argument
(
'-q'
,
action
=
'store_true'
,
dest
=
'quiet'
,
parser
.
add_argument
(
'-q'
,
action
=
'store_true'
,
dest
=
'quiet'
,
...
@@ -203,6 +207,12 @@ def main():
...
@@ -203,6 +207,12 @@ def main():
import
re
import
re
args
.
rx
=
re
.
compile
(
args
.
rx
)
args
.
rx
=
re
.
compile
(
args
.
rx
)
if
args
.
recursion
is
not
None
:
maxlevels
=
args
.
recursion
else
:
maxlevels
=
args
.
maxlevels
# if flist is provided then load it
# if flist is provided then load it
if
args
.
flist
:
if
args
.
flist
:
try
:
try
:
...
@@ -222,7 +232,7 @@ def main():
...
@@ -222,7 +232,7 @@ def main():
args
.
quiet
,
args
.
legacy
):
args
.
quiet
,
args
.
legacy
):
success
=
False
success
=
False
else
:
else
:
if
not
compile_dir
(
dest
,
args
.
maxlevels
,
args
.
ddir
,
if
not
compile_dir
(
dest
,
maxlevels
,
args
.
ddir
,
args
.
force
,
args
.
rx
,
args
.
quiet
,
args
.
force
,
args
.
rx
,
args
.
quiet
,
args
.
legacy
):
args
.
legacy
):
success
=
False
success
=
False
...
...
Lib/test/test_compileall.py
Dosyayı görüntüle @
344ff4ab
...
@@ -273,6 +273,40 @@ class CommandLineTests(unittest.TestCase):
...
@@ -273,6 +273,40 @@ class CommandLineTests(unittest.TestCase):
self
.
assertCompiled
(
subinitfn
)
self
.
assertCompiled
(
subinitfn
)
self
.
assertCompiled
(
hamfn
)
self
.
assertCompiled
(
hamfn
)
def
test_recursion_limit
(
self
):
subpackage
=
os
.
path
.
join
(
self
.
pkgdir
,
'spam'
)
subpackage2
=
os
.
path
.
join
(
subpackage
,
'ham'
)
subpackage3
=
os
.
path
.
join
(
subpackage2
,
'eggs'
)
for
pkg
in
(
subpackage
,
subpackage2
,
subpackage3
):
script_helper
.
make_pkg
(
pkg
)
subinitfn
=
os
.
path
.
join
(
subpackage
,
'__init__.py'
)
hamfn
=
script_helper
.
make_script
(
subpackage
,
'ham'
,
''
)
spamfn
=
script_helper
.
make_script
(
subpackage2
,
'spam'
,
''
)
eggfn
=
script_helper
.
make_script
(
subpackage3
,
'egg'
,
''
)
self
.
assertRunOK
(
'-q'
,
'-r 0'
,
self
.
pkgdir
)
self
.
assertNotCompiled
(
subinitfn
)
self
.
assertFalse
(
os
.
path
.
exists
(
os
.
path
.
join
(
subpackage
,
'__pycache__'
)))
self
.
assertRunOK
(
'-q'
,
'-r 1'
,
self
.
pkgdir
)
self
.
assertCompiled
(
subinitfn
)
self
.
assertCompiled
(
hamfn
)
self
.
assertNotCompiled
(
spamfn
)
self
.
assertRunOK
(
'-q'
,
'-r 2'
,
self
.
pkgdir
)
self
.
assertCompiled
(
subinitfn
)
self
.
assertCompiled
(
hamfn
)
self
.
assertCompiled
(
spamfn
)
self
.
assertNotCompiled
(
eggfn
)
self
.
assertRunOK
(
'-q'
,
'-r 5'
,
self
.
pkgdir
)
self
.
assertCompiled
(
subinitfn
)
self
.
assertCompiled
(
hamfn
)
self
.
assertCompiled
(
spamfn
)
self
.
assertCompiled
(
eggfn
)
def
test_quiet
(
self
):
def
test_quiet
(
self
):
noisy
=
self
.
assertRunOK
(
self
.
pkgdir
)
noisy
=
self
.
assertRunOK
(
self
.
pkgdir
)
quiet
=
self
.
assertRunOK
(
'-q'
,
self
.
pkgdir
)
quiet
=
self
.
assertRunOK
(
'-q'
,
self
.
pkgdir
)
...
...
Misc/NEWS
Dosyayı görüntüle @
344ff4ab
...
@@ -121,6 +121,9 @@ Core and Builtins
...
@@ -121,6 +121,9 @@ Core and Builtins
Library
Library
-------
-------
-
Issue
#
19628
:
Allow
compileall
recursion
depth
to
be
specified
with
a
-
r
option
.
-
Issue
#
15696
:
Add
a
__sizeof__
implementation
for
mmap
objects
on
Windows
.
-
Issue
#
15696
:
Add
a
__sizeof__
implementation
for
mmap
objects
on
Windows
.
-
Issue
#
22068
:
Avoided
reference
loops
with
Variables
and
Fonts
in
Tkinter
.
-
Issue
#
22068
:
Avoided
reference
loops
with
Variables
and
Fonts
in
Tkinter
.
...
...
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