views:

331

answers:

3

This is related to this question I asked a while back.

The end game is I want to be able to install my package "identity.model" and all dependencies. like so...

$ easy_install -f http://eggs.sadphaeton.com identity.model
Searching for identity.model
Reading http://eggs.sadphaeton.com
Reading http://pypi.python.org/simple/identity.model/
Couldn't find index page for 'identity.model' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading http://pypi.python.org/simple/
No local packages or download links found for identity.model
error: Could not find suitable distribution for Requirement.parse('identity.model')

for whatever reason running this easy_install hits the home page which I laid out according to this information

My index.html

<html>
 <head>
     <title>SadPhaeton Egg Repository</title>
 </head>
 <body>
    <a rel="homepage" href="AlchemyExtra">AlchemyExtra</a>
    <a rel="homepage" href="identity.model">identity.model</a>
    <a rel="homepage" href="repoze.what.plugins.config">repoze.what.plugins.config</a>

 </body>
</html>

if I run ...

$ easy_install -i http://eggs.sadphaeton.com identity.model

it does find my package and the repoze.what.plugins.config I put up there as well since it's a dependency. however then when it goes to fetch tw.forms(external dependency hosted on pypi) It ends with a failure as it only searched http://eggs.sadphaeton.com

Obviously I've misunderstood the "spec". Anyone have any idea what the trick is?

+2  A: 

-f will take the url you give it, and look there for packages, as well as on PyPI. An example of such a page is http://dist.plone.org/release/3.3.1/ As you see, this is a list of distribution files.

With -i you define the main index page. It defaults to http://pypi.python.org/simple/ As you see, the index page is an index of packages, not of distribution files.

So in your case easy_install -i http://eggs.sadphaeton.com identity.model should work to download identity.model. And it did for me, like twice in the middle, but not the first time nor the second time. I don't know if you maybe are trying different formats? But in any case, it will then fail on tw.forms, as it's not on your index page.

So the solution should be to make a page like http://dist.plone.org/release/3.3.1/ with your eggs on it. I don't know how exact the format has to be, but I think it's quite flexible.

Update:

Here is a step for step solution:

  1. Put all your distributions in a directory.
  2. cd to that directory.
  3. Type python -c "from SimpleHTTPServer import test; test()"
  4. Now type easy_install -f http://localhost:8080/ <modulename>

It will install the module.

Lennart Regebro
looks like the difference between the index you refer to and mine is those are all source distributions so I wonder if it's the distribution of eggs that makes this harder. sidenote: looks like webfaction doesn't set the mime-type properly for eggs, which I think is making pip fail as well.
Tom Willis
No, the main difference is that it lists all the distributions, ie all the available files, on one page. You list the packages, not the distributions. identity.model, vs identity.model-0.0dev-py2.6.egg. Also, your files have the wrong content type, possibly that's a difference too.
Lennart Regebro
In other words, that Plone listing is simply nothing but a directory listing of all the eggs with the filenames linked to the files. I don't know if rel="download" is relevant, but the Plone listing does not have it and neither does the PyPI index.
Lennart Regebro
but pypi does have subdirectories. for example for Toscawidgets, easy_install hits Reading http://pypi.python.org/simple/ToscaWidgets/Reading http://toscawidgets.org/Reading http://toscawidgets.org/download/and this pagehttp://pypi.python.org/simple/ToscaWidgets/is more than a directory listing. this is all the stuff I'm trying to understand.
Tom Willis
Right, but subdirectories are for an index with -i. Then you replace PyPI and don't even read it, and then you need to have all packages there, not just your own. It really is quite easy: Stick all the packages in a directory, and enable directly listing for it. Done.
Lennart Regebro
A: 

Well looks like the trick is in having the rel="download" links on the index.html of the root.

<html>
<head>
    <title>SadPhaeton Egg Repository</title>
</head>
<body>
    <a rel="homepage" href="AlchemyExtra">AlchemyExtra</a> <a rel="download" href="AlchemyExtra/AlchemyExtra-0.0dev-py2.6.egg">download</a><br>
    <a rel="homepage" href="identity.model">identity.model</a> <a rel="download" href="identity.model/identity.model-0.0dev-py2.6.egg">download</a><br>

    <a rel="homepage" href="repoze.what.plugins.config">repoze.what.plugins.config</a> <a rel="download" href="repoze.what.plugins.config/repoze.what.plugins.config-0.0.0-py2.6.egg">download</a><br>

</body>
</html>

that solves my immediate issue, though it would be nice if there were more details on this in the spec. I was expecting based on what I read that easy_install would consult the homepage for download link but it doesn't seem to want to do that for me.

now to somehow automate this because doing this crap manually is a PITA.

Tom Willis
Use your webserver to make a directory listing, and stick all the eggs in that directory. That should do it. I'm pretty sure the Plone listing is just an nginx listing a directory.
Lennart Regebro
A: 

The problem is you're trying to mix -i and -f modes of making your page; you need to pick one or the other, as the rel="" stuff only works with -i.

If you want to use -f mode, then you just need a webserver directory with the eggs in it. If you want to use -i, then you must have a subdirectory for each project with an index.html in it, and it's those index.html files that would contain the rel="homepage" stuff.

pjeby