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
f0a0a0db
Kaydet (Commit)
f0a0a0db
authored
May 09, 2008
tarafından
Brett Cannon
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add support for extension modules in 3.0 deprection command.
üst
9ac3974d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
9 deletions
+28
-9
2 to 3 - Module Deletion.tmCommand
...-Dev.tmbundle/Commands/2 to 3 - Module Deletion.tmCommand
+28
-9
No files found.
Misc/TextMate/Python-Dev.tmbundle/Commands/2 to 3 - Module Deletion.tmCommand
Dosyayı görüntüle @
f0a0a0db
...
@@ -11,26 +11,45 @@
...
@@ -11,26 +11,45 @@
XXX Not supported:
XXX Not supported:
- Module's in a package do not have their full name generated.
- Module's in a package do not have their full name generated.
- Package's __init__ module; should detect and use the package's name instead.
- Package's __init__ module; should detect and use the package's name instead.
- Extension modules; need to create template.
"""
"""
template = """from warnings import warnpy3k
py_
template = """from warnings import warnpy3k
warnpy3k("the ${1:%s} module has been removed in Python 3.0", stacklevel=2)
warnpy3k("the ${1:%s} module has been removed in Python 3.0", stacklevel=2)
del warnpy3k
del warnpy3k$0"""
$0"""
c_template = """
if (PyErr_WarnPy3k("the ${1:%s} module has been removed in "
"Python 3.0", 2)
<
0)
return;$0"""
import imp
import imp
import os
import os
file_name = os.path.split(os.environ['TM_FILEPATH'])[1]
file_name = os.path.split(os.environ['TM_FILEPATH'])[1]
for suffix in (tuple_[0] for tuple_ in imp.get_suffixes()):
if not file_name.endswith(suffix):
py_suffixes = reversed(sorted((suffix[0] for suffix in imp.get_suffixes() if suffix[2] == imp.PY_SOURCE), key=len))
c_suffixes = reversed(sorted((os.path.splitext(suffix[0])[0] + '.c'
for suffix in imp.get_suffixes() if suffix[2] == imp.C_EXTENSION), key=len))
pairings = ((py_suffixes, py_template), (c_suffixes, c_template))
def create_template(suffixes, template):
for suffix in suffixes:
if not file_name.endswith(suffix):
continue
module_name = file_name[:-len(suffix)]
return template % module_name
else:
return None
for template in (create_template(*pair) for pair in pairings):
if not template:
continue
continue
module_name = file_name[:-len(suffix)]
print template,
print (template % module_name),
break
break
else:
else:
print
(template % "XXX"),
</string>
print
'XXX Could not generate code.'
</string>
<key>
input
</key>
<key>
input
</key>
<string>
none
</string>
<string>
none
</string>
<key>
name
</key>
<key>
name
</key>
...
...
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