Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
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ç
LibreOffice
core
Commits
4855946a
Kaydet (Commit)
4855946a
authored
Kas 09, 2013
tarafından
Michael Stahl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
get-bugzilla-attachments-by-mimetype: make this run on Python 3
Change-Id: I27cf30c62122ea191c852a1a298a40ef64d35ba9
üst
1b82dba6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
6 deletions
+22
-6
get-bugzilla-attachments-by-mimetype
bin/get-bugzilla-attachments-by-mimetype
+22
-6
No files found.
bin/get-bugzilla-attachments-by-mimetype
Dosyayı görüntüle @
4855946a
...
@@ -18,13 +18,19 @@
...
@@ -18,13 +18,19 @@
#
#
#where X is the n'th attachment of that type in the bug
#where X is the n'th attachment of that type in the bug
import
urllib
import
feedparser
import
feedparser
import
base64
import
base64
import
re
import
re
import
os
,
os
.
path
import
os
,
os
.
path
import
sys
import
sys
import
xmlrpclib
try
:
from
urllib.request
import
urlopen
except
:
from
urllib
import
urlopen
try
:
import
xmlrpc.client
as
xmlrpclib
except
:
import
xmlrpclib
from
xml.dom
import
minidom
from
xml.dom
import
minidom
from
xml.sax.saxutils
import
escape
from
xml.sax.saxutils
import
escape
...
@@ -32,7 +38,7 @@ def urlopen_retry(url):
...
@@ -32,7 +38,7 @@ def urlopen_retry(url):
maxretries
=
3
maxretries
=
3
for
i
in
range
(
maxretries
+
1
):
for
i
in
range
(
maxretries
+
1
):
try
:
try
:
return
url
lib
.
url
open
(
url
)
return
urlopen
(
url
)
except
IOError
as
e
:
except
IOError
as
e
:
print
(
"caught IOError: "
+
e
)
print
(
"caught IOError: "
+
e
)
if
maxretries
==
i
:
if
maxretries
==
i
:
...
@@ -67,7 +73,7 @@ def get_from_bug_url_via_xml(url, mimetype, prefix, suffix):
...
@@ -67,7 +73,7 @@ def get_from_bug_url_via_xml(url, mimetype, prefix, suffix):
download
=
suffix
+
'/'
+
prefix
+
id
+
'-'
+
str
(
attachmentid
)
+
'.'
+
suffix
download
=
suffix
+
'/'
+
prefix
+
id
+
'-'
+
str
(
attachmentid
)
+
'.'
+
suffix
print
(
'downloading as '
+
download
)
print
(
'downloading as '
+
download
)
f
=
open
(
download
,
'w'
)
f
=
open
(
download
,
'w
b
'
)
f
.
write
(
base64
.
b64decode
(
node
.
firstChild
.
nodeValue
))
f
.
write
(
base64
.
b64decode
(
node
.
firstChild
.
nodeValue
))
f
.
close
()
f
.
close
()
break
break
...
@@ -98,7 +104,11 @@ def get_novell_bug_via_xml(url, mimetype, prefix, suffix):
...
@@ -98,7 +104,11 @@ def get_novell_bug_via_xml(url, mimetype, prefix, suffix):
continue
continue
print
(
" mimetype is"
)
print
(
" mimetype is"
)
remoteMime
=
handle
.
info
()
.
gettype
()
info
=
handle
.
info
()
if
info
.
get_content_type
:
remoteMime
=
info
.
get_content_type
()
else
:
remoteMime
=
info
.
gettype
()
print
(
remoteMime
)
print
(
remoteMime
)
if
remoteMime
!=
mimetype
:
if
remoteMime
!=
mimetype
:
print
(
"skipping"
)
print
(
"skipping"
)
...
@@ -106,11 +116,15 @@ def get_novell_bug_via_xml(url, mimetype, prefix, suffix):
...
@@ -106,11 +116,15 @@ def get_novell_bug_via_xml(url, mimetype, prefix, suffix):
download
=
suffix
+
'/'
+
prefix
+
id
+
'-'
+
str
(
attachmentid
)
+
'.'
+
suffix
download
=
suffix
+
'/'
+
prefix
+
id
+
'-'
+
str
(
attachmentid
)
+
'.'
+
suffix
print
(
'downloading as '
+
download
)
print
(
'downloading as '
+
download
)
f
=
open
(
download
,
'w'
)
f
=
open
(
download
,
'w
b
'
)
f
.
write
(
handle
.
read
())
f
.
write
(
handle
.
read
())
f
.
close
()
f
.
close
()
def
get_through_rpc_query
(
rpcurl
,
showurl
,
mimetype
,
prefix
,
suffix
):
def
get_through_rpc_query
(
rpcurl
,
showurl
,
mimetype
,
prefix
,
suffix
):
try
:
os
.
mkdir
(
suffix
)
except
:
pass
try
:
try
:
proxy
=
xmlrpclib
.
ServerProxy
(
rpcurl
)
proxy
=
xmlrpclib
.
ServerProxy
(
rpcurl
)
query
=
dict
()
query
=
dict
()
...
@@ -144,6 +158,8 @@ def get_through_rss_query_url(url, mimetype, prefix, suffix):
...
@@ -144,6 +158,8 @@ def get_through_rss_query_url(url, mimetype, prefix, suffix):
for
entry
in
d
[
'entries'
]:
for
entry
in
d
[
'entries'
]:
try
:
try
:
get_bug_function
(
entry
[
'id'
],
mimetype
,
prefix
,
suffix
)
get_bug_function
(
entry
[
'id'
],
mimetype
,
prefix
,
suffix
)
except
KeyboardInterrupt
:
raise
# Ctrl+C should work
except
:
except
:
print
(
entry
[
'id'
]
+
" failed: "
+
sys
.
exc_info
()[
0
])
print
(
entry
[
'id'
]
+
" failed: "
+
sys
.
exc_info
()[
0
])
pass
pass
...
...
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