| 1 | ==================== |
|---|
| 2 | Getting a bzr repo |
|---|
| 3 | ==================== |
|---|
| 4 | |
|---|
| 5 | If you're just installing pkgcore from a released tarball, skip this section. |
|---|
| 6 | |
|---|
| 7 | To get the current (development) code without history, install bazaar_ |
|---|
| 8 | (``emerge bzr`` on gentoo) and run:: |
|---|
| 9 | |
|---|
| 10 | bzr co --lightweight http://bzr.pkgcore.org/<branch> |
|---|
| 11 | |
|---|
| 12 | Currently the "main" branches are ``ferringb/pkgcore-dev`` and |
|---|
| 13 | ``marienz/pkgcore-dev``. |
|---|
| 14 | |
|---|
| 15 | If you also want history, omit ``--lightweight`` (beware: this is over |
|---|
| 16 | 10 mb of data). |
|---|
| 17 | |
|---|
| 18 | .. _bazaar: http://bazaar-vcs.org/ |
|---|
| 19 | |
|---|
| 20 | ==================== |
|---|
| 21 | Installing pkgcore |
|---|
| 22 | ==================== |
|---|
| 23 | |
|---|
| 24 | Set PYTHONPATH |
|---|
| 25 | ============== |
|---|
| 26 | |
|---|
| 27 | If you only want to run scripts from pkgcore itself (the ones in its |
|---|
| 28 | "bin" directory) you do not have to do anything with PYTHONPATH. If |
|---|
| 29 | you want to use pkgcore from an interactive python interpreter session |
|---|
| 30 | you do not have to do anything if you start the interpreter from the |
|---|
| 31 | "root" of the pkgcore source tree. For other uses you probably want to |
|---|
| 32 | set PYTHONPATH to include your pkgcore directory, so that python can |
|---|
| 33 | find the pkgcore code. For example:: |
|---|
| 34 | |
|---|
| 35 | $ export PYTHONPATH="${PYTHONPATH}:/home/user/pkgcore/" |
|---|
| 36 | |
|---|
| 37 | Now test to see if it works:: |
|---|
| 38 | |
|---|
| 39 | $ python -c'import pkgcore' |
|---|
| 40 | |
|---|
| 41 | Python will scan pkgcore, see the pkgcore directory in it (and that it has |
|---|
| 42 | __init__.py), and use that. |
|---|
| 43 | |
|---|
| 44 | |
|---|
| 45 | Registering plugins |
|---|
| 46 | =================== |
|---|
| 47 | |
|---|
| 48 | Pkgcore uses plugins for some basic functionality. You do not really |
|---|
| 49 | have to do anything to get this working, but things are a bit faster |
|---|
| 50 | if the plugin cache is up to date. This happens automatically if the |
|---|
| 51 | cache is stale and the user running pkgcore may write there, but if |
|---|
| 52 | pkgcore is installed somewhere system-wide and you only run it as user |
|---|
| 53 | you can force a regeneration with:: |
|---|
| 54 | |
|---|
| 55 | # pplugincache |
|---|
| 56 | |
|---|
| 57 | If you want to update plugin caches for something other than pkgcore's |
|---|
| 58 | core plugin registry, pass the package name as an argument. |
|---|
| 59 | |
|---|
| 60 | Test pkgcore |
|---|
| 61 | ============ |
|---|
| 62 | |
|---|
| 63 | Drop back to normal user, and try:: |
|---|
| 64 | |
|---|
| 65 | $ python |
|---|
| 66 | >>> import pkgcore.config |
|---|
| 67 | >>> from pkgcore.ebuild.atom import atom |
|---|
| 68 | >>> conf=pkgcore.config.load_config() |
|---|
| 69 | >>> tree=conf.get_default('domain').repos[1] |
|---|
| 70 | >>> pkg=max(tree.itermatch(atom("dev-util/diffball"))) |
|---|
| 71 | >>> print pkg |
|---|
| 72 | >>> print pkg.depends |
|---|
| 73 | >=dev-libs/openssl-0.9.6j >=sys-libs/zlib-1.1.4 >=app-arch/bzip2-1.0.2 |
|---|
| 74 | |
|---|
| 75 | |
|---|
| 76 | At the time of writing the domain interface is in flux, so this example might |
|---|
| 77 | fail for you. If it doesn't work ask for assistance in #pkgcore on freenode, |
|---|
| 78 | or email ferringb (at) gmail.com' with the traceback. |
|---|
| 79 | |
|---|
| 80 | Build extensions |
|---|
| 81 | ================ |
|---|
| 82 | |
|---|
| 83 | If you want to run pkgcore from its source directory but also want the |
|---|
| 84 | extra speed from the compiled extension modules, compile them in place:: |
|---|
| 85 | |
|---|
| 86 | $ python setup.py build_ext -i |
|---|