Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
  • 16 commits
  • 6 files changed
  • 0 commit comments
  • 2 contributors
Showing with 70 additions and 65 deletions.
  1. +2 −3 enstaller.egg-info/post_egginst.py
  2. +28 −0 enstaller/README.txt
  3. +23 −25 enstaller/config.py
  4. +5 −2 enstaller/enpkg.py
  5. +1 −1 enstaller/main.py
  6. +11 −34 enstaller/store/indexed.py
View
5 enstaller.egg-info/post_egginst.py
@@ -23,9 +23,8 @@ def write_egginst(path, d):
d['files'] = []
for f in d['rel_files'] + [path]:
p = abspath(join(sys.prefix, f))
- d['files'].append(
- p.replace(sys.prefix, '.').replace('\\', '/')
- if p.startswith(sys.prefix) else p)
+ d['files'].append(p.replace(sys.prefix, '.').replace('\\', '/')
+ if p.startswith(sys.prefix) else p)
del d['rel_files']
d['prefix'] = sys.prefix
View
28 enstaller/README.txt
@@ -0,0 +1,28 @@
+The index.json file maps keys (which are the egg filenames) to
+info dictionaries. These dictionaries have the following keys:
+
+Required:
+---------
+name name of the package (lowercase) (string)
+version version (string)
+build build number (integer)
+size file size in bytes (integer)
+md5 MD5 hashsum of the file
+mtime file modification time (seconds since Unix epoch) (float)
+
+
+Optional:
+---------
+packages list of dependency packages, e.g. ['numpy 1.6.1', 'scipy'],
+ defaults to [], i.e. no dependencies
+python Python version the package is build for, defaults to '2.7'
+type defaults to 'egg'
+available boolean which indicated whether the file (egg) is available,
+ i.e. whether one is privileged to download the file,
+ defaults to True
+
+
+Note that these are the only keys which enstaller cares about.
+One might add other ones, which the Enpkg query methods will respect
+and pass along, but the behaviour of enstaller itself is not
+affected by their values.
View
48 enstaller/config.py
@@ -11,10 +11,11 @@
from utils import PY_VER, abs_expanduser, fill_url
import plat
+
try:
import keyring
import keyring.backend
- # Don't use keyring backends that require console input or just do
+ # don't use keyring backends that require console input or just do
# more or less the same thing we're already doing
keyring.backend._all_keyring = [keyring.backend.OSXKeychain(),
keyring.backend.GnomeKeyring(),
@@ -25,7 +26,9 @@
keyring.core.init_backend()
if keyring.get_keyring().supported() < 0:
keyring = None
-except ImportError:
+except (ImportError, KeyError):
+ # the KeyError happens on Windows when the environment variable
+ # 'USERPROFILE' is not set
keyring = None
KEYRING_SERVICE_NAME = 'Enthought.com'
@@ -35,17 +38,15 @@
system_config_path = join(sys.prefix, config_fn)
pypi_url = 'http://www.enthought.com/repo/pypi/eggs/'
-info_url = 'http://www.enthought.com/epd/index-info.bz2'
-upgrade_epd_url = 'http://www.enthought.com/epd/upgrade'
default = dict(
- info_url=info_url,
prefix=sys.prefix,
proxy=None,
noapp=False,
local=join(sys.prefix, 'LOCAL-REPO'),
EPD_auth=None,
EPD_userpass=None,
+ use_webservice=True,
IndexedRepos=[pypi_url + plat.subdir + '/'],
)
@@ -86,27 +87,28 @@ def input_auth():
# This file was created by initially running the enpkg command.
%(auth_section)s
+
+# use_webservice refers to using 'https://api.enthought.com/eggs/',
+# the default is True, i.e. the webservice URL is used for fetching eggs.
+# Uncommenting changes this behaviour, to use the explicit IndexedRepos
+# listed below.
+#use_webservice = False
+
# The enpkg command is searching for eggs in the list 'IndexedRepos'.
# When enpkg is searching for an egg, it tries to find it in the order
# of this list, and selects the first one that matches, ignoring
# repositories below. Therefore the order of this list matters.
#
-# Placeholders '{ARCH}' get substituted by 'amd64' or 'x86', depending
-# on the architecture of the current interpreter.
-#
-# Notice also that only indexed repositories, i.e. HTTP directories which
-# contain a file 'index-depend.bz2' (next to the eggs), can be listed here.
# For local repositories, the index file is optional. Remember that on
# Windows systems the backslaches in the directory path need to escaped, e.g.:
# r'file://C:\\repository\\' or 'file://C:\\\\repository\\\\'
IndexedRepos = [
-%(repo_section)s]
-
-# The following variable is optional and, if provided, point to a URL which
-# contains an index file with additional package information, such as the
-# package home-page, license type, description. The information is displayed
-# by the --info option.
-#info_url = 'http://www.enthought.com/epd/index-info.bz2'
+# 'https://www.enthought.com/repo/ets/eggs/{SUBDIR}/',
+ 'https://www.enthought.com/repo/epd/GPL-eggs/{SUBDIR}/',
+ 'https://www.enthought.com/repo/epd/eggs/{SUBDIR}/',
+# The Enthought PyPI build mirror:
+ 'http://www.enthought.com/repo/pypi/eggs/{SUBDIR}/',
+]
# Install prefix (enpkg --prefix and --sys-prefix options overwrite this).
# When this variable is not provided, it will default to the value of
@@ -128,11 +130,6 @@ def write(username=None, password=None, proxy=None):
"""
write the config file
"""
- try:
- from custom_tools import repo_section
- except ImportError:
- repo_section = ''
-
# If user is 'root', then always create the config file in sys.prefix,
# otherwise in the user's HOME directory.
if sys.platform != 'win32' and os.getuid() == 0:
@@ -268,7 +265,7 @@ def read():
return read.cache
path = get_path()
- read.cache = {}
+ read.cache = default
if path is None:
return read.cache
@@ -292,12 +289,13 @@ def print_config():
print "sys.prefix:", sys.prefix
print "platform:", platform.platform()
print "architecture:", platform.architecture()[0]
+ print "use_webservice:", get('use_webservice')
print "config file:", get_path()
print
print "settings:"
- for k in 'info_url', 'prefix', 'local', 'noapp', 'proxy':
+ for k in 'prefix', 'local', 'noapp', 'proxy':
print " %s = %r" % (k, get(k))
- print " IndexedRepos:"
+ print " IndexedRepos:", '(not used)' if get('use_webservice') else ''
for repo in get('IndexedRepos'):
print ' %r' % repo
View
7 enstaller/enpkg.py
@@ -26,9 +26,12 @@ def create_joined_store(urls):
raise Exception("cannot create store: %r" % url)
return JoinedStore(stores)
+def get_default_url():
+ import plat
+ return 'https://api.enthought.com/eggs/%s/' % plat.custom_plat
+
def get_default_kvs():
- url = 'https://beta.enthought.com/webservice/kvs'
- return RemoteHTTPIndexedStore(url)
+ return RemoteHTTPIndexedStore(get_default_url())
def req_from_anything(arg):
if isinstance(arg, Req):
View
2 enstaller/main.py
@@ -330,7 +330,7 @@ def main():
else:
evt_mgr = None
- if config.get_path() is None or config.get('use_webservice'):
+ if config.get('use_webservice'):
remote = None # Enpkg will create the default
else:
urls = [fill_url(u) for u in config.get('IndexedRepos')]
View
45 enstaller/store/indexed.py
@@ -2,7 +2,6 @@
import urlparse
import urllib2
from collections import defaultdict
-from os.path import basename
from base import AbstractStore
@@ -11,53 +10,31 @@ class IndexedStore(AbstractStore):
def connect(self, userpass=None):
self.userpass = userpass # tuple(username, password)
- self._webservice = 'webservice/kvs' in self.root
- if self._webservice:
- import enstaller.plat as plat
-
- fp = self.get_data('index.json?plat=' + plat.custom_plat)
- if fp is None:
- raise Exception("could not connect")
- self._index = {}
- for path, info in json.load(fp).iteritems():
- if plat.subdir in path:
- info['_path'] = path
- self._index[basename(path)] = info
- else:
- fp = self.get_data('index.json')
- if fp is None:
- raise Exception("could not connect")
- self._index = json.load(fp)
- fp.close()
+ self._index = self.get_index()
#for k, v in self._index.iteritems():
# print k, v
for info in self._index.itervalues():
info['store_location'] = self.info().get('root')
- if 'type' not in info:
- info['type'] = 'egg'
- if 'python' not in info:
- info['python'] = '2.7'
- if 'packages' not in info:
- info['packages'] = []
- # for testing only:
- #if info['name'] in ('fastnumpy', 'numexpr'):
- # info['available'] = False
+ info.setdefault('type', 'egg')
+ info.setdefault('python', '2.7')
+ info.setdefault('packages', [])
# maps names to keys
self._groups = defaultdict(list)
for key, info in self._index.iteritems():
- try:
- self._groups[info['name']].append(key)
- except KeyError:
- pass
+ self._groups[info['name']].append(key)
+
+ def get_index(self):
+ fp = self.get_data('index.json')
+ if fp is None:
+ raise Exception("could not connect")
+ return json.load(fp)
def _location(self, key):
rt = self.root.rstrip('/') + '/'
- if self._webservice and key.endswith(('.egg', '.zdiff')):
- return rt + self._index[key]['_path']
if key.endswith('.zdiff'):
return rt + 'patches/' + key
return rt + key

No commit comments for this range

Something went wrong with that request. Please try again.