{"id":336,"date":"2014-11-10T00:17:46","date_gmt":"2014-11-09T23:17:46","guid":{"rendered":"https:\/\/blogs.gentoo.org\/mgorny\/?p=336"},"modified":"2014-11-10T00:19:00","modified_gmt":"2014-11-09T23:19:00","slug":"pypy-is-back-and-for-real-this-time","status":"publish","type":"post","link":"https:\/\/blogs.gentoo.org\/mgorny\/2014\/11\/10\/pypy-is-back-and-for-real-this-time\/","title":{"rendered":"PyPy is back, and for real this time!"},"content":{"rendered":"<p>As you may recall, I was looking for a\u00a0dedicated PyPy maintainer for quite some time. Sadly, all the\u00a0people who helped (and\u00a0who I&#8217;d like to thank a\u00a0lot) ended up lacking time soon enough. So finally I&#8217;ve decided to look into the\u00a0hacks reducing build-time memory use and\u00a0take care of\u00a0the\u00a0necessary ebuild and\u00a0packaging work myself.<\/p>\n<p><!--more--><\/p>\n<p>So first of\u00a0all, you may notice that the\u00a0new PyPy (source-code) ebuilds have a\u00a0new USE flag called <em>low-memory<\/em>. When this flag is\u00a0enabled, the\u00a0translation process is done using PyPy with some memory-reducing adjustments suggested by\u00a0upstream. The\u00a0net result is that it finally is possible to build PyPy with 3.5G RAM (on\u00a0amd64) and\u00a01G of swap (the\u00a0latter being used the\u00a0compiler is spawned and\u00a0memory used during translation is no longer necessary), at a\u00a0cost of\u00a0slightly increased build time.<\/p>\n<p>As\u00a0noted above, the\u00a0low-memory option requires using PyPy to perform the\u00a0translation. So while having to\u00a0enforce that, I went a\u00a0bit further and\u00a0made the\u00a0ebuild default to using PyPy whenever available. In\u00a0fact, even for a\u00a0first PyPy build you are recommended to install <em>dev-python\/pypy-bin<\/em> first and\u00a0let the\u00a0ebuild use it to bootstrap your own PyPy.<\/p>\n<p>Next, I have cleaned up the\u00a0ebuilds a\u00a0bit and\u00a0enforced more consistency. Changing maintainers and\u00a0binary package builders have resulted in\u00a0the\u00a0ebuilds being a\u00a0bit inconsistent. Now you can finally expect pypy-bin to install exactly the\u00a0same set of\u00a0files as source-built pypy.<\/p>\n<p>I have also cleaned up the\u00a0remaining libpypy-c symlinks. The\u00a0library is not packaged upstream currently, and\u00a0therefore has no proper public name. Using libpypy-c.so is just wrong, and\u00a0packages can&#8217;t reliably refer to that. I&#8217;d rather wait with installing it till there&#8217;s some precedence in\u00a0renaming. The\u00a0shared library is still built but\u00a0it&#8217;s kept inside the\u00a0PyPy home directory.<\/p>\n<p>All those changes were followed by a\u00a0proper version bump to 2.4.0. While you still may have <a rel=\"external\" href=\"https:\/\/bugs.gentoo.org\/show_bug.cgi?id=526160\">issues upgrading PyPy<\/a>, Zac already committed a\u00a0patch to\u00a0Portage and\u00a0the\u00a0next release should be\u00a0able to handle PyPy upgrades seamlessly. I have also built all the\u00a0supported binary package variants, so you can choose those if you don&#8217;t want to spend time building PyPy.<\/p>\n<p>Finally, I have added the\u00a0ebuilds for PyPy 3. They are a\u00a0little bit more complex than regular PyPy, especially because the\u00a0build process and\u00a0some of\u00a0the\u00a0internal modules still require Python 2. Sadly, PyPy 3 is based on Python 3.2 with small backports, so I don&#8217;t expect package compatibility much greater than CPython 3.2 had.<\/p>\n<p>If you want to try building some packages with PyPy 3, you can use the\u00a0convenience <em>PYTHON_COMPAT_OVERRIDE<\/em> hack:<\/p>\n<pre><code>PYTHON_COMPAT_OVERRIDE='pypy3' emerge -1v mypackage<\/code><\/pre>\n<p>Please note that it is only a\u00a0hack, and\u00a0as\u00a0such it doesn&#8217;t set proper USE flags (<em>PYTHON_TARGETS<\/em> are simply ignored) or\u00a0enforce dependencies.<\/p>\n<p>If someone wants to help PyPy on\u00a0Gentoo a\u00a0bit, there are still unsolved issues needing a\u00a0lot of\u00a0specialist work. More specifically:<\/p>\n<ol>\n<li><a rel=\"external\" href=\"https:\/\/bugs.gentoo.org\/show_bug.cgi?id=465546\">#465546<\/a>; PyPy needs to be\u00a0modified to support <em>\/usr<\/em> prefix properly (right now, it requires prefix being <em>\/usr\/lib*\/pypy<\/em> which breaks distutils packages assuming otherwise.<\/li>\n<li><a rel=\"external\" href=\"https:\/\/bugs.gentoo.org\/show_bug.cgi?id=525940\">#525940<\/a>; non-SSE2 JIT does not build.<\/li>\n<li><a rel=\"external\" href=\"https:\/\/bugs.gentoo.org\/show_bug.cgi?id=429372\">#429372<\/a>; we lack proper sandbox install support.<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>As you may recall, I was looking for a\u00a0dedicated PyPy maintainer for quite some time. Sadly, all the\u00a0people who helped (and\u00a0who I&#8217;d like to thank a\u00a0lot) ended up lacking time soon enough. So finally I&#8217;ve decided to look into the\u00a0hacks reducing build-time memory use and\u00a0take care of\u00a0the\u00a0necessary ebuild and\u00a0packaging work myself.<\/p>\n","protected":false},"author":137,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true},"categories":[3],"tags":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/blogs.gentoo.org\/mgorny\/wp-json\/wp\/v2\/posts\/336"}],"collection":[{"href":"https:\/\/blogs.gentoo.org\/mgorny\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.gentoo.org\/mgorny\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.gentoo.org\/mgorny\/wp-json\/wp\/v2\/users\/137"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.gentoo.org\/mgorny\/wp-json\/wp\/v2\/comments?post=336"}],"version-history":[{"count":1,"href":"https:\/\/blogs.gentoo.org\/mgorny\/wp-json\/wp\/v2\/posts\/336\/revisions"}],"predecessor-version":[{"id":337,"href":"https:\/\/blogs.gentoo.org\/mgorny\/wp-json\/wp\/v2\/posts\/336\/revisions\/337"}],"wp:attachment":[{"href":"https:\/\/blogs.gentoo.org\/mgorny\/wp-json\/wp\/v2\/media?parent=336"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.gentoo.org\/mgorny\/wp-json\/wp\/v2\/categories?post=336"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.gentoo.org\/mgorny\/wp-json\/wp\/v2\/tags?post=336"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}