简体   繁体   中英

Buildout - installing eggs from source

I have a buildout that includes three source repositories for python libraries (it's a Django web app with two reusable libraries). Everything works great from a developers perspective, but now I want to build distributions to deploy. So in my buildout.cfg I have:

[buildout]
parts =
    django
develop =
    src/lib1
    src/lib2
    src/django_app
eggs =
    lib1
    lib2
    django_app

[django]
recipe = djangorecipe
...
eggs =
    lib1
    lib2
    django_app
    ...

How do I tell buildout to package those as eggs and install them in eg eggs/ instead of develop-eggs/ as links back to the source?

What I'd like to be able to do after the buildout is capture the built eggs of lib1 and lib2 and upload them to my local pypi repo. My alternative is to manually run python setup.py bdist_egg , but it seems like buildout should already know about that.

Grabbing and installing eggs is different from making and hosting them, that's why buildout itself doesn't provide a pypi server or something like that.

So... you yourself have to make proper eggs/releases and place them somewhere buildout can find them.

  • I assume your libraries have a setup.py ? For a good release you need to update the version number and tag your release in svn/hg/bzr/git. (To make this easier and less time consuming, look at zest.releaser ).

  • There are a couple of pypi clones that you can install locally and where you can upload your custom packages. But the simplest solution is to have a directory with releases somewhere and host it with apache or nginx, see https://stackoverflow.com/a/13354463/27401 . Add that URL to your [buildout] part as find-links = http://example.com/my_packages/ . Buildout will now look inside that page (so: make sure to tell apache to list all the files in that directory). Setuptools uses a standard naming scheme ( mypackage-1.2.zip ), that's how it works.

  • Only thing left to do is to get your files into that apache/nginx directory on the server. To start with, a simple custom-made script might be enough. For more automation, look at tags2sdists . You feed it a directory with source packages and a directory where it can place the packaged releases. You know, you could even run it from within your buildout as bin/tags2sdists src/ var/packages/ . This creates source packages from all your tags and places them in var/packages/ . Afterwards copy them somewhere else.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM