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
c93938b5
Unverified
Kaydet (Commit)
c93938b5
authored
Nis 09, 2018
tarafından
Serhiy Storchaka
Kaydeden (comit)
GitHub
Nis 09, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-31920: Fixed handling directories as arguments in the ``pygettext`` script. (GH-6259)
Based on patch by Oleg Krasnikov.
üst
827d49f3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
20 deletions
+39
-20
test_i18n.py
Lib/test/test_tools/test_i18n.py
+25
-1
ACKS
Misc/ACKS
+1
-0
2018-03-26-18-54-24.bpo-31920.u_WKsT.rst
...next/Tools-Demos/2018-03-26-18-54-24.bpo-31920.u_WKsT.rst
+2
-0
pygettext.py
Tools/i18n/pygettext.py
+11
-19
No files found.
Lib/test/test_tools/test_i18n.py
Dosyayı görüntüle @
c93938b5
...
@@ -7,7 +7,7 @@ import textwrap
...
@@ -7,7 +7,7 @@ import textwrap
from
test.support.script_helper
import
assert_python_ok
from
test.support.script_helper
import
assert_python_ok
from
test.test_tools
import
skip_if_missing
,
toolsdir
from
test.test_tools
import
skip_if_missing
,
toolsdir
from
test.support
import
temp_cwd
from
test.support
import
temp_cwd
,
temp_dir
skip_if_missing
()
skip_if_missing
()
...
@@ -160,3 +160,27 @@ class Test_pygettext(unittest.TestCase):
...
@@ -160,3 +160,27 @@ class Test_pygettext(unittest.TestCase):
"""doc"""
"""doc"""
'''
))
'''
))
self
.
assertIn
(
'doc'
,
msgids
)
self
.
assertIn
(
'doc'
,
msgids
)
def
test_files_list
(
self
):
"""Make sure the directories are inspected for source files
bpo-31920
"""
text1
=
'Text to translate1'
text2
=
'Text to translate2'
text3
=
'Text to ignore'
with
temp_cwd
(
None
),
temp_dir
(
None
)
as
sdir
:
os
.
mkdir
(
os
.
path
.
join
(
sdir
,
'pypkg'
))
with
open
(
os
.
path
.
join
(
sdir
,
'pypkg'
,
'pymod.py'
),
'w'
)
as
sfile
:
sfile
.
write
(
f
'_({text1!r})'
)
os
.
mkdir
(
os
.
path
.
join
(
sdir
,
'pkg.py'
))
with
open
(
os
.
path
.
join
(
sdir
,
'pkg.py'
,
'pymod2.py'
),
'w'
)
as
sfile
:
sfile
.
write
(
f
'_({text2!r})'
)
os
.
mkdir
(
os
.
path
.
join
(
sdir
,
'CVS'
))
with
open
(
os
.
path
.
join
(
sdir
,
'CVS'
,
'pymod3.py'
),
'w'
)
as
sfile
:
sfile
.
write
(
f
'_({text3!r})'
)
assert_python_ok
(
self
.
script
,
sdir
)
with
open
(
'messages.pot'
)
as
fp
:
data
=
fp
.
read
()
self
.
assertIn
(
f
'msgid "{text1}"'
,
data
)
self
.
assertIn
(
f
'msgid "{text2}"'
,
data
)
self
.
assertNotIn
(
text3
,
data
)
Misc/ACKS
Dosyayı görüntüle @
c93938b5
...
@@ -853,6 +853,7 @@ Maksim Kozyarchuk
...
@@ -853,6 +853,7 @@ Maksim Kozyarchuk
Stefan Krah
Stefan Krah
Rolf Krahl
Rolf Krahl
Bob Kras
Bob Kras
Oleg Krasnikov
Sebastian Kreft
Sebastian Kreft
Holger Krekel
Holger Krekel
Michael Kremer
Michael Kremer
...
...
Misc/NEWS.d/next/Tools-Demos/2018-03-26-18-54-24.bpo-31920.u_WKsT.rst
0 → 100644
Dosyayı görüntüle @
c93938b5
Fixed handling directories as arguments in the ``pygettext`` script. Based
on patch by Oleg Krasnikov.
Tools/i18n/pygettext.py
Dosyayı görüntüle @
c93938b5
...
@@ -259,24 +259,6 @@ def containsAny(str, set):
...
@@ -259,24 +259,6 @@ def containsAny(str, set):
return
1
in
[
c
in
str
for
c
in
set
]
return
1
in
[
c
in
str
for
c
in
set
]
def
_visit_pyfiles
(
list
,
dirname
,
names
):
"""Helper for getFilesForName()."""
# get extension for python source files
if
'_py_ext'
not
in
globals
():
global
_py_ext
_py_ext
=
importlib
.
machinery
.
SOURCE_SUFFIXES
[
0
]
# don't recurse into CVS directories
if
'CVS'
in
names
:
names
.
remove
(
'CVS'
)
# add all *.py files to list
list
.
extend
(
[
os
.
path
.
join
(
dirname
,
file
)
for
file
in
names
if
os
.
path
.
splitext
(
file
)[
1
]
==
_py_ext
]
)
def
getFilesForName
(
name
):
def
getFilesForName
(
name
):
"""Get a list of module files for a filename, a module or package name,
"""Get a list of module files for a filename, a module or package name,
or a directory.
or a directory.
...
@@ -302,7 +284,17 @@ def getFilesForName(name):
...
@@ -302,7 +284,17 @@ def getFilesForName(name):
if
os
.
path
.
isdir
(
name
):
if
os
.
path
.
isdir
(
name
):
# find all python files in directory
# find all python files in directory
list
=
[]
list
=
[]
os
.
walk
(
name
,
_visit_pyfiles
,
list
)
# get extension for python source files
_py_ext
=
importlib
.
machinery
.
SOURCE_SUFFIXES
[
0
]
for
root
,
dirs
,
files
in
os
.
walk
(
name
):
# don't recurse into CVS directories
if
'CVS'
in
dirs
:
dirs
.
remove
(
'CVS'
)
# add all *.py files to list
list
.
extend
(
[
os
.
path
.
join
(
root
,
file
)
for
file
in
files
if
os
.
path
.
splitext
(
file
)[
1
]
==
_py_ext
]
)
return
list
return
list
elif
os
.
path
.
exists
(
name
):
elif
os
.
path
.
exists
(
name
):
# a single file
# a single file
...
...
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