Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
I
inary
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)
1
Konular (issue)
1
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ç
SulinOS
inary
Commits
db6a4ac4
Kaydet (Commit)
db6a4ac4
authored
Tem 07, 2005
tarafından
Barış Metin
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
progress hadisesini biraz daha düzeltmeye çalıştım...
üst
e54fe0dd
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
25 additions
and
21 deletions
+25
-21
pisi-cli
pisi-cli
+8
-6
fetcher.py
pisi/fetcher.py
+11
-9
index.py
pisi/index.py
+1
-1
package.py
pisi/package.py
+1
-1
sourcearchive.py
pisi/sourcearchive.py
+3
-3
ui.py
pisi/ui.py
+1
-1
No files found.
pisi-cli
Dosyayı görüntüle @
db6a4ac4
...
...
@@ -76,13 +76,15 @@ class PisiCLI(object):
#print 'rargs', parser.rargs, 'vals', parser.values
self
.
command
=
parser
.
rargs
[
0
]
# now for the real parser
parser
=
OptionParser
(
usage
=
usage
,
version
=
"
%
prog "
+
pisi
.
__version__
)
parser
.
allow_interspersed_args
=
False
self
.
parser
=
commonopts
(
parser
)
self
.
add_subcommand_opts
()
(
self
.
options
,
args
)
=
self
.
parser
.
parse_args
()
# # now for the real parser
# parser = OptionParser(usage=usage, version="%prog " + pisi.__version__)
# parser.allow_interspersed_args = False
# self.parser = commonopts(parser)
# self.add_subcommand_opts()
# (self.options, args) = sel
# f.parser.parse_args()
self
.
args
=
args
[
1
:]
print
options
self
.
authInfo
=
None
self
.
checkAuthInfo
()
...
...
pisi/fetcher.py
Dosyayı görüntüle @
db6a4ac4
# -*- coding: utf-8 -*-
# Yet another Pisi module for fetching files from various sources. Of
...
...
@@ -19,11 +20,11 @@ class FetchError (Exception):
pass
# helper functions
def
fetchUrl
(
url
,
dest
,
p
ercentHook
=
None
):
def
fetchUrl
(
url
,
dest
,
p
rogress
=
None
):
fetch
=
Fetcher
(
url
,
dest
)
fetch
.
p
ercentHook
=
percentHook
fetch
.
p
rogress
=
progress
fetch
.
fetch
()
if
p
ercentHook
:
if
p
rogress
:
ui
.
info
(
'
\n
'
)
...
...
@@ -61,13 +62,14 @@ class Fetcher:
symbols
=
[
' B/s'
,
'KB/s'
,
'MB/s'
,
'GB/s'
]
from
time
import
time
tt
,
oldsize
=
int
(
time
()),
0
p
=
ui
.
Progress
(
totalsize
)
bs
,
size
=
1024
,
0
symbol
,
depth
=
"B/s"
,
0
st
=
time
()
chunk
=
fileURI
.
read
(
bs
)
size
=
size
+
len
(
chunk
)
self
.
percent
=
p
.
update
(
size
)
if
self
.
progress
:
p
=
self
.
progress
(
totalsize
)
self
.
percent
=
p
.
update
(
size
)
while
chunk
:
dest
.
write
(
chunk
)
chunk
=
fileURI
.
read
(
bs
)
...
...
@@ -80,14 +82,14 @@ class Fetcher:
depth
+=
1
symbol
,
depth
=
symbols
[
depth
],
0
oldsize
,
tt
=
size
,
time
()
if
p
.
update
(
size
)
:
self
.
percent
=
p
.
percent
if
self
.
percentHook
:
if
self
.
progress
:
if
p
.
update
(
size
):
self
.
percent
=
p
.
percent
retval
=
{
'filename'
:
self
.
url
.
filename
(),
'percent'
:
self
.
percent
,
'rate'
:
self
.
rate
,
'symbol'
:
symbol
}
self
.
percentHook
(
retval
)
ui
.
displayProgress
(
retval
)
dest
.
close
()
...
...
pisi/index.py
Dosyayı görüntüle @
db6a4ac4
...
...
@@ -27,7 +27,7 @@ class Index(XmlFile):
from
os
import
getcwd
from
fetcher
import
fetchUrl
# TODO: index dosyasını indirmek için bir yer bulmak lazım.
fetchUrl
(
url
,
getcwd
(),
ui
.
display
Progress
)
fetchUrl
(
url
,
getcwd
(),
ui
.
Progress
)
self
.
filename
=
url
.
filename
()
self
.
readxml
(
self
.
filename
)
...
...
pisi/package.py
Dosyayı görüntüle @
db6a4ac4
...
...
@@ -20,7 +20,7 @@ class Package:
from
ui
import
ui
# TODO: belki Constants.packages_dir() gibi bir yere
# indirmek daha iyi olur.
fetchUrl
(
url
,
getcwd
(),
ui
.
display
Progress
)
fetchUrl
(
url
,
getcwd
(),
ui
.
Progress
)
self
.
filename
=
url
.
filename
()
self
.
impl
=
archive
.
ArchiveZip
(
self
.
filename
,
'zip'
,
mode
)
...
...
pisi/sourcearchive.py
Dosyayı görüntüle @
db6a4ac4
...
...
@@ -26,13 +26,13 @@ class SourceArchive:
self
.
ctx
=
ctx
self
.
url
=
PUrl
(
self
.
ctx
.
spec
.
source
.
archiveUri
)
self
.
dest
=
join
(
config
.
archives_dir
(),
self
.
url
.
filename
())
self
.
showProgress
=
None
def
fetch
(
self
,
interactive
=
True
):
if
not
self
.
isCached
(
interactive
):
if
interactive
:
self
.
showProgress
=
ui
.
displayProgress
fetchUrl
(
self
.
url
,
config
.
archives_dir
(),
self
.
showProgress
)
progress
=
ui
.
Progress
else
:
progress
=
None
fetchUrl
(
self
.
url
,
config
.
archives_dir
(),
progress
)
def
isCached
(
self
,
interactive
=
True
):
if
not
access
(
self
.
dest
,
R_OK
):
...
...
pisi/ui.py
Dosyayı görüntüle @
db6a4ac4
...
...
@@ -31,7 +31,7 @@ class CLI:
def
__init__
(
self
,
totalsize
):
self
.
totalsize
=
totalsize
self
.
percent
=
0
def
update
(
self
,
size
):
if
not
self
.
totalsize
:
return
100
...
...
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