Commit b364978e authored by PJ Eby's avatar PJ Eby

Backport fixes and doc updates; prep for 0.6c6 release

--HG--
branch : setuptools-0.6
extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/branches/setuptools-0.6%4055712
parent 89111e61
...@@ -442,6 +442,19 @@ or PyPI mirror. See the ``--index-url`` option under `Command-Line Options`_, ...@@ -442,6 +442,19 @@ or PyPI mirror. See the ``--index-url`` option under `Command-Line Options`_,
below, and also the section on the `Package Index "API"`_. below, and also the section on the `Package Index "API"`_.
Password-Protected Sites
------------------------
If a site you want to download from is password-protected using HTTP "Basic"
authentication, you can specify your credentials in the URL, like so::
http://some_userid:some_password@some.example.com/some_path/
You can do this with both index page URLs and direct download URLs. As long
as any HTML pages read by easy_install use *relative* links to point to the
downloads, the same user ID and password will be used to do the downloading.
Controlling Build Options Controlling Build Options
~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~
...@@ -1231,6 +1244,8 @@ Release Notes/Change History ...@@ -1231,6 +1244,8 @@ Release Notes/Change History
* Added ``--local-snapshots-ok`` flag, to allow building eggs from projects * Added ``--local-snapshots-ok`` flag, to allow building eggs from projects
installed using ``setup.py develop``. installed using ``setup.py develop``.
* Fixed not HTML-decoding URLs scraped from web pages
0.6c5 0.6c5
* Fixed ``.dll`` files on Cygwin not having executable permisions when an egg * Fixed ``.dll`` files on Cygwin not having executable permisions when an egg
is installed unzipped. is installed unzipped.
......
...@@ -1052,7 +1052,7 @@ def get_default_cache(): ...@@ -1052,7 +1052,7 @@ def get_default_cache():
dirname = '' dirname = ''
for key in keys: for key in keys:
if key in os.environ: if key in os.environ:
dirname = os.path.join(os.environ[key]) dirname = os.path.join(dirname, os.environ[key])
else: else:
break break
else: else:
......
...@@ -1697,6 +1697,9 @@ Release Notes/Change History ...@@ -1697,6 +1697,9 @@ Release Notes/Change History
* Allow ``.egg-link`` files to contain relative paths. * Allow ``.egg-link`` files to contain relative paths.
* Fix cache dir defaults on Windows when multiple environment vars are needed
to construct a path.
0.6c4 0.6c4
* Fix "dev" versions being considered newer than release candidates. * Fix "dev" versions being considered newer than release candidates.
......
...@@ -1485,8 +1485,10 @@ all practical purposes, you'll probably use only the ``--formats`` option, if ...@@ -1485,8 +1485,10 @@ all practical purposes, you'll probably use only the ``--formats`` option, if
you use any option at all. you use any option at all.
(By the way, if you're using some other revision control system, you might (By the way, if you're using some other revision control system, you might
consider submitting a patch to the ``setuptools.command.sdist`` module, consider creating and publishing a `revision control plugin for setuptools`_.)
so we can include support for your system.)
.. _revision control plugin for setuptools: `Adding Support for Other Revision Control Systems`_
Making your package available for EasyInstall Making your package available for EasyInstall
...@@ -2627,6 +2629,9 @@ Release Notes/Change History ...@@ -2627,6 +2629,9 @@ Release Notes/Change History
being tested was installed on ``sys.path`` ahead of the test source being tested was installed on ``sys.path`` ahead of the test source
directory. directory.
* Fix ``find_packages()`` treating ``ez_setup`` and directories with ``.`` in
their names as packages.
0.6c5 0.6c5
* Fix uploaded ``bdist_rpm`` packages being described as ``bdist_egg`` * Fix uploaded ``bdist_rpm`` packages being described as ``bdist_egg``
packages under Python versions less than 2.5. packages under Python versions less than 2.5.
......
...@@ -30,11 +30,11 @@ def find_packages(where='.', exclude=()): ...@@ -30,11 +30,11 @@ def find_packages(where='.', exclude=()):
where,prefix = stack.pop(0) where,prefix = stack.pop(0)
for name in os.listdir(where): for name in os.listdir(where):
fn = os.path.join(where,name) fn = os.path.join(where,name)
if (os.path.isdir(fn) and if ('.' not in name and os.path.isdir(fn) and
os.path.isfile(os.path.join(fn,'__init__.py')) os.path.isfile(os.path.join(fn,'__init__.py'))
): ):
out.append(prefix+name); stack.append((fn,prefix+name+'.')) out.append(prefix+name); stack.append((fn,prefix+name+'.'))
for pat in exclude: for pat in list(exclude)+['ez_setup']:
from fnmatch import fnmatchcase from fnmatch import fnmatchcase
out = [item for item in out if not fnmatchcase(item,pat)] out = [item for item in out if not fnmatchcase(item,pat)]
return out return out
......
...@@ -132,14 +132,14 @@ def find_external_links(url, page): ...@@ -132,14 +132,14 @@ def find_external_links(url, page):
rels = map(str.strip, rel.lower().split(',')) rels = map(str.strip, rel.lower().split(','))
if 'homepage' in rels or 'download' in rels: if 'homepage' in rels or 'download' in rels:
for match in HREF.finditer(tag): for match in HREF.finditer(tag):
yield urlparse.urljoin(url, match.group(1)) yield urlparse.urljoin(url, htmldecode(match.group(1)))
for tag in ("<th>Home Page", "<th>Download URL"): for tag in ("<th>Home Page", "<th>Download URL"):
pos = page.find(tag) pos = page.find(tag)
if pos!=-1: if pos!=-1:
match = HREF.search(page,pos) match = HREF.search(page,pos)
if match: if match:
yield urlparse.urljoin(url, match.group(1)) yield urlparse.urljoin(url, htmldecode(match.group(1)))
user_agent = "Python-urllib/%s setuptools/%s" % ( user_agent = "Python-urllib/%s setuptools/%s" % (
urllib2.__version__, require('setuptools')[0].version urllib2.__version__, require('setuptools')[0].version
...@@ -200,7 +200,7 @@ class PackageIndex(Environment): ...@@ -200,7 +200,7 @@ class PackageIndex(Environment):
if url.startswith(self.index_url) and getattr(f,'code',None)!=404: if url.startswith(self.index_url) and getattr(f,'code',None)!=404:
page = self.process_index(url, page) page = self.process_index(url, page)
for match in HREF.finditer(page): for match in HREF.finditer(page):
link = urlparse.urljoin(base, match.group(1)) link = urlparse.urljoin(base, htmldecode(match.group(1)))
self.process_url(link) self.process_url(link)
def process_filename(self, fn, nested=False): def process_filename(self, fn, nested=False):
...@@ -262,7 +262,7 @@ class PackageIndex(Environment): ...@@ -262,7 +262,7 @@ class PackageIndex(Environment):
# process an index page into the package-page index # process an index page into the package-page index
for match in HREF.finditer(page): for match in HREF.finditer(page):
scan( urlparse.urljoin(url, match.group(1)) ) scan( urlparse.urljoin(url, htmldecode(match.group(1))) )
pkg, ver = scan(url) # ensure this page is in the page index pkg, ver = scan(url) # ensure this page is in the page index
if pkg: if pkg:
...@@ -611,6 +611,8 @@ class PackageIndex(Environment): ...@@ -611,6 +611,8 @@ class PackageIndex(Environment):
self.url_ok(url, True) # raises error if not allowed self.url_ok(url, True) # raises error if not allowed
return self._attempt_download(url, filename) return self._attempt_download(url, filename)
def scan_url(self, url): def scan_url(self, url):
self.process_url(url, True) self.process_url(url, True)
...@@ -652,6 +654,44 @@ class PackageIndex(Environment): ...@@ -652,6 +654,44 @@ class PackageIndex(Environment):
def warn(self, msg, *args): def warn(self, msg, *args):
log.warn(msg, *args) log.warn(msg, *args)
# This pattern matches a character entity reference (a decimal numeric
# references, a hexadecimal numeric reference, or a named reference).
entity_sub = re.compile(r'&(#(\d+|x[\da-fA-F]+)|[\w.:-]+);?').sub
def uchr(c):
if not isinstance(c, int):
return c
if c>255: return unichr(c)
return chr(c)
def decode_entity(match):
what = match.group(1)
if what.startswith('#x'):
what = int(what[2:], 16)
elif what.startswith('#'):
what = int(what[1:])
else:
from htmlentitydefs import name2codepoint
what = name2codepoint.get(what, match.group(0))
return uchr(what)
def htmldecode(text):
"""Decode HTML entities in the given text."""
return entity_sub(decode_entity, text)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment