X Tutup
Skip to content

Commit 4a7ca01

Browse files
committed
SESPRINGPYTHONPY-128: Removed all S3 dependencies from coily.
git-svn-id: https://src.springframework.org/svn/se-springpython-py/trunk/springpython@747 ce8fead1-4192-4296-8608-a705134b927f
1 parent 94ff99f commit 4a7ca01

File tree

1 file changed

+1
-60
lines changed

1 file changed

+1
-60
lines changed

src/plugins/coily-template

Lines changed: 1 addition & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import getopt
2525
import shutil
2626
import urllib
2727
from datetime import datetime
28-
#import S3
2928

3029
############################################################################
3130
# Get external properties and load into a dictionary. NOTE: These properties
@@ -63,77 +62,19 @@ def list_installed_plugins():
6362
print "\t%s is not a valid plugin" % plugin
6463

6564
def list_available_plugins():
66-
modules = get_modules_from_s3()
67-
print "Available plugins:"
68-
for key in modules:
69-
#if key.startswith("springpython-sample"):
70-
for rev in modules[key]:
71-
if __version__ in rev[1]:
72-
print "\t%s\t%s\t%s" % (key, rev[1], rev[3])
65+
print "S3 is no longer browsable. Available plugins are only available in your current working directory."
7366

7467
def install_plugin(name):
7568
"""Go through a series of options to look for Spring Python modules to download."""
7669
if not os.path.exists(plugin_path(name)):
7770
print "Installing plugin %s to %s" % (name, p["plugindir"])
78-
if fetch_from_s3(name):
79-
print "Found %s online. Installing." % name
80-
return
8171
if fetch_locally(name):
8272
print "Found %s locally. Installing." % name
8373
return
8474
print "Couldn't find %s anywhere!" % name
8575
else:
8676
print "%s is already installed. We do NOT support automated upgrades." % name
8777

88-
def get_modules_from_s3():
89-
"""Read the S3 site for information about existing modules."""
90-
url = "http://s3browse.com/explore/dist.springframework.org/release/EXT/se-springpython-py"
91-
info = urllib.urlopen(url).read()
92-
choicesR = re.compile('<a href="/getObject/(.*?)">(.*?)</a>.*?<td align="right">(.*?)</td>.*?<td align="right">(.*?)</td>', re.DOTALL)
93-
match = choicesR.findall(info)
94-
converted = []
95-
for item in match:
96-
if "springpython-plugin" not in item[0]: continue
97-
if item[0].endswith(".sha1"): continue
98-
t = time.strptime(item[3], "%Y-%m-%d %H:%M")
99-
d = datetime(year=t.tm_year, month=t.tm_mon, day=t.tm_mday, hour=t.tm_hour, minute=t.tm_min)
100-
converted.append(("http://s3.amazonaws.com/" + item[0], item[1], item[2]+"K", item[3], d))
101-
modules = {}
102-
baseR = re.compile("springpython-plugin-([a-zA-Z-]*)-([0-9a-zA-Z]+.*).tar.gz")
103-
for item in converted:
104-
try:
105-
modules[baseR.match(item[1]).group(1)].append(item)
106-
except KeyError:
107-
modules[baseR.match(item[1]).group(1)] = [item]
108-
return modules
109-
110-
def fetch_from_s3(name):
111-
"""Download a selected item"""
112-
selected = None
113-
try:
114-
for item in get_modules_from_s3()[name]:
115-
if __version__ in item[1]:
116-
selected = item
117-
except KeyError:
118-
pass
119-
120-
if selected is None:
121-
print "Couldn't find %s online!" % name
122-
return None
123-
else:
124-
print "Fetching %s as %s" % (selected[0], selected[1])
125-
urllib.urlretrieve(selected[0], selected[1])
126-
t = tarfile.open(selected[1], "r:gz")
127-
top = t.getmembers()[0]
128-
if os.path.exists(name):
129-
shutil.rmtree(name)
130-
for member in t.getmembers():
131-
t.extract(member)
132-
fetch_locally(name)
133-
shutil.rmtree(name)
134-
os.remove(selected[1])
135-
return True
136-
13778
def fetch_locally(name):
13879
"""Scan the local directory for Spring Python modules to install."""
13980
try:

0 commit comments

Comments
 (0)
X Tutup