Skip to content

Commit

Permalink
added ability to optionally read the platforms (found in a repo) from…
Browse files Browse the repository at this point in the history
… a local file

git-svn-id: https://svn.enthought.com/svn/enthought/Enstaller/trunk@23886 651a555e-23ca-0310-84fe-ca9f7c59d2ea
  • Loading branch information
ischnell committed Jun 19, 2009
1 parent dd4bb7d commit f9c8b4f
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions enstaller/indexed_repo/platforms.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from os.path import isdir, join
from setuptools.package_index import open_with_auth


Expand All @@ -8,19 +9,21 @@ def to_list(s):
class Platforms(object):
"""
An instance represents the list of platforms which are available in a
repository.
repository. An instance in instantiated by either a local directory
or a URL which points to an HTTP server.
"""

def __init__(self, url):
self.url = url + 'platforms.txt'
self.set_txt()
self.set_data()

def set_txt(self):
handle = open_with_auth(self.url)
self.txt = handle.read()
handle.close()
fn = 'platforms.txt'
if isdir(url):
self.txt = open(join(url, fn)).read()
else:
handle = open_with_auth(url + fn)
self.txt = handle.read()
handle.close()

self.set_data()

def set_data(self):
self.data = {}
for line in self.txt.splitlines():
Expand Down

0 comments on commit f9c8b4f

Please sign in to comment.