s3_cmd_bin 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/s3_cmd_bin/version.rb +1 -1
- data/resources/ChangeLog +0 -0
- data/resources/INSTALL +0 -0
- data/resources/MANIFEST.in +1 -0
- data/resources/NEWS +1 -40
- data/resources/README +0 -0
- data/resources/S3/ACL.py +0 -0
- data/resources/S3/AccessLog.py +0 -0
- data/resources/S3/BidirMap.py +0 -0
- data/resources/S3/CloudFront.py +8 -37
- data/resources/S3/Config.py +1 -88
- data/resources/S3/Exceptions.py +1 -1
- data/resources/S3/FileLists.py +100 -272
- data/resources/S3/MultiPart.py +21 -45
- data/resources/S3/PkgInfo.py +1 -1
- data/resources/S3/Progress.py +0 -17
- data/resources/S3/S3.py +52 -148
- data/resources/S3/S3Uri.py +2 -3
- data/resources/S3/SimpleDB.py +0 -3
- data/resources/S3/SortedDict.py +0 -3
- data/resources/S3/Utils.py +3 -80
- data/resources/S3/__init__.py +0 -0
- data/resources/TODO +0 -0
- data/resources/artwork/AtomicClockRadio.ttf +0 -0
- data/resources/artwork/TypeRa.ttf +0 -0
- data/resources/artwork/site-top-full-size.xcf +0 -0
- data/resources/artwork/site-top-label-download.png +0 -0
- data/resources/artwork/site-top-label-s3cmd.png +0 -0
- data/resources/artwork/site-top-label-s3sync.png +0 -0
- data/resources/artwork/site-top-s3tools-logo.png +0 -0
- data/resources/artwork/site-top.jpg +0 -0
- data/resources/artwork/site-top.png +0 -0
- data/resources/artwork/site-top.xcf +0 -0
- data/resources/run-tests.py +2 -2
- data/resources/s3cmd +306 -600
- data/resources/s3cmd.1 +97 -84
- data/resources/setup.cfg +0 -0
- data/resources/setup.py +0 -0
- data/resources/testsuite.tar.gz +0 -0
- metadata +2 -26
- data/resources/LICENSE +0 -339
- data/resources/Makefile +0 -4
- data/resources/S3/ACL.pyc +0 -0
- data/resources/S3/AccessLog.pyc +0 -0
- data/resources/S3/BidirMap.pyc +0 -0
- data/resources/S3/CloudFront.pyc +0 -0
- data/resources/S3/Config.pyc +0 -0
- data/resources/S3/ConnMan.py +0 -71
- data/resources/S3/ConnMan.pyc +0 -0
- data/resources/S3/Exceptions.pyc +0 -0
- data/resources/S3/FileDict.py +0 -53
- data/resources/S3/FileDict.pyc +0 -0
- data/resources/S3/FileLists.pyc +0 -0
- data/resources/S3/HashCache.py +0 -53
- data/resources/S3/HashCache.pyc +0 -0
- data/resources/S3/MultiPart.pyc +0 -0
- data/resources/S3/PkgInfo.pyc +0 -0
- data/resources/S3/Progress.pyc +0 -0
- data/resources/S3/S3.pyc +0 -0
- data/resources/S3/S3Uri.pyc +0 -0
- data/resources/S3/SortedDict.pyc +0 -0
- data/resources/S3/Utils.pyc +0 -0
- data/resources/S3/__init__.pyc +0 -0
- data/resources/magic +0 -63
data/resources/Makefile
DELETED
data/resources/S3/ACL.pyc
DELETED
Binary file
|
data/resources/S3/AccessLog.pyc
DELETED
Binary file
|
data/resources/S3/BidirMap.pyc
DELETED
Binary file
|
data/resources/S3/CloudFront.pyc
DELETED
Binary file
|
data/resources/S3/Config.pyc
DELETED
Binary file
|
data/resources/S3/ConnMan.py
DELETED
@@ -1,71 +0,0 @@
|
|
1
|
-
import httplib
|
2
|
-
from urlparse import urlparse
|
3
|
-
from threading import Semaphore
|
4
|
-
from logging import debug, info, warning, error
|
5
|
-
|
6
|
-
from Config import Config
|
7
|
-
from Exceptions import ParameterError
|
8
|
-
|
9
|
-
__all__ = [ "ConnMan" ]
|
10
|
-
|
11
|
-
class http_connection(object):
|
12
|
-
def __init__(self, id, hostname, ssl, cfg):
|
13
|
-
self.hostname = hostname
|
14
|
-
self.ssl = ssl
|
15
|
-
self.id = id
|
16
|
-
self.counter = 0
|
17
|
-
if cfg.proxy_host != "":
|
18
|
-
self.c = httplib.HTTPConnection(cfg.proxy_host, cfg.proxy_port)
|
19
|
-
elif not ssl:
|
20
|
-
self.c = httplib.HTTPConnection(hostname)
|
21
|
-
else:
|
22
|
-
self.c = httplib.HTTPSConnection(hostname)
|
23
|
-
|
24
|
-
class ConnMan(object):
|
25
|
-
conn_pool_sem = Semaphore()
|
26
|
-
conn_pool = {}
|
27
|
-
conn_max_counter = 800 ## AWS closes connection after some ~90 requests
|
28
|
-
|
29
|
-
@staticmethod
|
30
|
-
def get(hostname, ssl = None):
|
31
|
-
cfg = Config()
|
32
|
-
if ssl == None:
|
33
|
-
ssl = cfg.use_https
|
34
|
-
conn = None
|
35
|
-
if cfg.proxy_host != "":
|
36
|
-
if ssl:
|
37
|
-
raise ParameterError("use_ssl=True can't be used with proxy")
|
38
|
-
conn_id = "proxy://%s:%s" % (cfg.proxy_host, cfg.proxy_port)
|
39
|
-
else:
|
40
|
-
conn_id = "http%s://%s" % (ssl and "s" or "", hostname)
|
41
|
-
ConnMan.conn_pool_sem.acquire()
|
42
|
-
if not ConnMan.conn_pool.has_key(conn_id):
|
43
|
-
ConnMan.conn_pool[conn_id] = []
|
44
|
-
if len(ConnMan.conn_pool[conn_id]):
|
45
|
-
conn = ConnMan.conn_pool[conn_id].pop()
|
46
|
-
debug("ConnMan.get(): re-using connection: %s#%d" % (conn.id, conn.counter))
|
47
|
-
ConnMan.conn_pool_sem.release()
|
48
|
-
if not conn:
|
49
|
-
debug("ConnMan.get(): creating new connection: %s" % conn_id)
|
50
|
-
conn = http_connection(conn_id, hostname, ssl, cfg)
|
51
|
-
conn.c.connect()
|
52
|
-
conn.counter += 1
|
53
|
-
return conn
|
54
|
-
|
55
|
-
@staticmethod
|
56
|
-
def put(conn):
|
57
|
-
if conn.id.startswith("proxy://"):
|
58
|
-
conn.c.close()
|
59
|
-
debug("ConnMan.put(): closing proxy connection (keep-alive not yet supported)")
|
60
|
-
return
|
61
|
-
|
62
|
-
if conn.counter >= ConnMan.conn_max_counter:
|
63
|
-
conn.c.close()
|
64
|
-
debug("ConnMan.put(): closing over-used connection")
|
65
|
-
return
|
66
|
-
|
67
|
-
ConnMan.conn_pool_sem.acquire()
|
68
|
-
ConnMan.conn_pool[conn.id].append(conn)
|
69
|
-
ConnMan.conn_pool_sem.release()
|
70
|
-
debug("ConnMan.put(): connection put back to pool (%s#%d)" % (conn.id, conn.counter))
|
71
|
-
|
data/resources/S3/ConnMan.pyc
DELETED
Binary file
|
data/resources/S3/Exceptions.pyc
DELETED
Binary file
|
data/resources/S3/FileDict.py
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
## Amazon S3 manager
|
2
|
-
## Author: Michal Ludvig <michal@logix.cz>
|
3
|
-
## http://www.logix.cz/michal
|
4
|
-
## License: GPL Version 2
|
5
|
-
|
6
|
-
from SortedDict import SortedDict
|
7
|
-
import Utils
|
8
|
-
|
9
|
-
class FileDict(SortedDict):
|
10
|
-
def __init__(self, mapping = {}, ignore_case = True, **kwargs):
|
11
|
-
SortedDict.__init__(self, mapping = mapping, ignore_case = ignore_case, **kwargs)
|
12
|
-
self.hardlinks = dict() # { dev: { inode : {'md5':, 'relative_files':}}}
|
13
|
-
self.by_md5 = dict() # {md5: set(relative_files)}
|
14
|
-
|
15
|
-
def record_md5(self, relative_file, md5):
|
16
|
-
if md5 not in self.by_md5:
|
17
|
-
self.by_md5[md5] = set()
|
18
|
-
self.by_md5[md5].add(relative_file)
|
19
|
-
|
20
|
-
def find_md5_one(self, md5):
|
21
|
-
try:
|
22
|
-
return list(self.by_md5.get(md5, set()))[0]
|
23
|
-
except:
|
24
|
-
return None
|
25
|
-
|
26
|
-
def get_md5(self, relative_file):
|
27
|
-
"""returns md5 if it can, or raises IOError if file is unreadable"""
|
28
|
-
md5 = None
|
29
|
-
if 'md5' in self[relative_file]:
|
30
|
-
return self[relative_file]['md5']
|
31
|
-
md5 = self.get_hardlink_md5(relative_file)
|
32
|
-
if md5 is None:
|
33
|
-
md5 = Utils.hash_file_md5(self[relative_file]['full_name'])
|
34
|
-
self.record_md5(relative_file, md5)
|
35
|
-
self[relative_file]['md5'] = md5
|
36
|
-
return md5
|
37
|
-
|
38
|
-
def record_hardlink(self, relative_file, dev, inode, md5):
|
39
|
-
if dev not in self.hardlinks:
|
40
|
-
self.hardlinks[dev] = dict()
|
41
|
-
if inode not in self.hardlinks[dev]:
|
42
|
-
self.hardlinks[dev][inode] = dict(md5=md5, relative_files=set())
|
43
|
-
self.hardlinks[dev][inode]['relative_files'].add(relative_file)
|
44
|
-
|
45
|
-
def get_hardlink_md5(self, relative_file):
|
46
|
-
md5 = None
|
47
|
-
dev = self[relative_file]['dev']
|
48
|
-
inode = self[relative_file]['inode']
|
49
|
-
try:
|
50
|
-
md5 = self.hardlinks[dev][inode]['md5']
|
51
|
-
except:
|
52
|
-
pass
|
53
|
-
return md5
|
data/resources/S3/FileDict.pyc
DELETED
Binary file
|
data/resources/S3/FileLists.pyc
DELETED
Binary file
|
data/resources/S3/HashCache.py
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
import cPickle as pickle
|
2
|
-
|
3
|
-
class HashCache(object):
|
4
|
-
def __init__(self):
|
5
|
-
self.inodes = dict()
|
6
|
-
|
7
|
-
def add(self, dev, inode, mtime, size, md5):
|
8
|
-
if dev not in self.inodes:
|
9
|
-
self.inodes[dev] = dict()
|
10
|
-
if inode not in self.inodes[dev]:
|
11
|
-
self.inodes[dev][inode] = dict()
|
12
|
-
self.inodes[dev][inode][mtime] = dict(md5=md5, size=size)
|
13
|
-
|
14
|
-
def md5(self, dev, inode, mtime, size):
|
15
|
-
try:
|
16
|
-
d = self.inodes[dev][inode][mtime]
|
17
|
-
if d['size'] != size:
|
18
|
-
return None
|
19
|
-
except:
|
20
|
-
return None
|
21
|
-
return d['md5']
|
22
|
-
|
23
|
-
def mark_all_for_purge(self):
|
24
|
-
for d in self.inodes.keys():
|
25
|
-
for i in self.inodes[d].keys():
|
26
|
-
for c in self.inodes[d][i].keys():
|
27
|
-
self.inodes[d][i][c]['purge'] = True
|
28
|
-
|
29
|
-
def unmark_for_purge(self, dev, inode, mtime, size):
|
30
|
-
d = self.inodes[dev][inode][mtime]
|
31
|
-
if d['size'] == size and 'purge' in d:
|
32
|
-
del self.inodes[dev][inode][mtime]['purge']
|
33
|
-
|
34
|
-
def purge(self):
|
35
|
-
for d in self.inodes.keys():
|
36
|
-
for i in self.inodes[d].keys():
|
37
|
-
for m in self.inodes[d][i].keys():
|
38
|
-
if 'purge' in self.inodes[d][i][m]:
|
39
|
-
del self.inodes[d][i]
|
40
|
-
break
|
41
|
-
|
42
|
-
def save(self, f):
|
43
|
-
d = dict(inodes=self.inodes, version=1)
|
44
|
-
f = open(f, 'w')
|
45
|
-
p = pickle.dump(d, f)
|
46
|
-
f.close()
|
47
|
-
|
48
|
-
def load(self, f):
|
49
|
-
f = open(f, 'r')
|
50
|
-
d = pickle.load(f)
|
51
|
-
f.close()
|
52
|
-
if d.get('version') == 1 and 'inodes' in d:
|
53
|
-
self.inodes = d['inodes']
|
data/resources/S3/HashCache.pyc
DELETED
Binary file
|
data/resources/S3/MultiPart.pyc
DELETED
Binary file
|
data/resources/S3/PkgInfo.pyc
DELETED
Binary file
|
data/resources/S3/Progress.pyc
DELETED
Binary file
|
data/resources/S3/S3.pyc
DELETED
Binary file
|
data/resources/S3/S3Uri.pyc
DELETED
Binary file
|
data/resources/S3/SortedDict.pyc
DELETED
Binary file
|
data/resources/S3/Utils.pyc
DELETED
Binary file
|
data/resources/S3/__init__.pyc
DELETED
Binary file
|
data/resources/magic
DELETED
@@ -1,63 +0,0 @@
|
|
1
|
-
# Additional magic for common web file types
|
2
|
-
|
3
|
-
0 string/b {\ " JSON data
|
4
|
-
!:mime application/json
|
5
|
-
0 string/b {\ } JSON data
|
6
|
-
!:mime application/json
|
7
|
-
0 string/b [ JSON data
|
8
|
-
!:mime application/json
|
9
|
-
|
10
|
-
0 search/4000 function
|
11
|
-
>&0 search/32/b )\ { JavaScript program
|
12
|
-
!:mime application/javascript
|
13
|
-
|
14
|
-
0 search/4000 @media CSS stylesheet
|
15
|
-
!:mime text/css
|
16
|
-
0 search/4000 @import CSS stylesheet
|
17
|
-
!:mime text/css
|
18
|
-
0 search/4000 @namespace CSS stylesheet
|
19
|
-
!:mime text/css
|
20
|
-
0 search/4000/b {\ background CSS stylesheet
|
21
|
-
!:mime text/css
|
22
|
-
0 search/4000/b {\ border CSS stylesheet
|
23
|
-
!:mime text/css
|
24
|
-
0 search/4000/b {\ bottom CSS stylesheet
|
25
|
-
!:mime text/css
|
26
|
-
0 search/4000/b {\ color CSS stylesheet
|
27
|
-
!:mime text/css
|
28
|
-
0 search/4000/b {\ cursor CSS stylesheet
|
29
|
-
!:mime text/css
|
30
|
-
0 search/4000/b {\ direction CSS stylesheet
|
31
|
-
!:mime text/css
|
32
|
-
0 search/4000/b {\ display CSS stylesheet
|
33
|
-
!:mime text/css
|
34
|
-
0 search/4000/b {\ float CSS stylesheet
|
35
|
-
!:mime text/css
|
36
|
-
0 search/4000/b {\ font CSS stylesheet
|
37
|
-
!:mime text/css
|
38
|
-
0 search/4000/b {\ height CSS stylesheet
|
39
|
-
!:mime text/css
|
40
|
-
0 search/4000/b {\ left CSS stylesheet
|
41
|
-
!:mime text/css
|
42
|
-
0 search/4000/b {\ line- CSS stylesheet
|
43
|
-
!:mime text/css
|
44
|
-
0 search/4000/b {\ margin CSS stylesheet
|
45
|
-
!:mime text/css
|
46
|
-
0 search/4000/b {\ padding CSS stylesheet
|
47
|
-
!:mime text/css
|
48
|
-
0 search/4000/b {\ position CSS stylesheet
|
49
|
-
!:mime text/css
|
50
|
-
0 search/4000/b {\ right CSS stylesheet
|
51
|
-
!:mime text/css
|
52
|
-
0 search/4000/b {\ text- CSS stylesheet
|
53
|
-
!:mime text/css
|
54
|
-
0 search/4000/b {\ top CSS stylesheet
|
55
|
-
!:mime text/css
|
56
|
-
0 search/4000/b {\ width CSS stylesheet
|
57
|
-
!:mime text/css
|
58
|
-
0 search/4000/b {\ visibility CSS stylesheet
|
59
|
-
!:mime text/css
|
60
|
-
0 search/4000/b {\ -moz- CSS stylesheet
|
61
|
-
!:mime text/css
|
62
|
-
0 search/4000/b {\ -webkit- CSS stylesheet
|
63
|
-
!:mime text/css
|