118 Commits

Author SHA1 Message Date
Ed Morley 71aef447a6 Migrate away from sp-grep (#1119)
Switches the last consumers of it to a simpler utility function that
uses `pkgutil.find_loader()`:
https://docs.python.org/3/library/pkgutil.html#pkgutil.find_loader

Both of these consumers are covered by existing tests.

Then removes `sp-grep` and the remaining parts of `pip-pop`.

Closes @W-8208817@.
2020-11-12 17:42:51 +00:00
Ed Morley 768d3fb9e5 Remove vendored pip-diff script (#1118)
Since the last usage was removed in #1117.

Whilst this tool was intended for internal buildpack usage only, the
vendor directory is on `PATH`, so I've documented the removal in
CHANGELOG just in case.

Refs @W-8208817@.
2020-11-12 13:54:14 +00:00
Ed Morley eb44bc03f1 Remove vendored pip-grep script (#1116)
Since the last usage was removed in #1113, and pip-grep is actually
broken on newer pip anyway (though helpfully silently ignores
exceptions, so one wouldn't know).

This is the first of the pip-pop removals, the rest will follow as the
last usages are switched over.

Whilst this tool was intended for internal buildpack usage only, the
vendor directory is on `PATH`, so I've documented the removal in
CHANGELOG just in case.

Refs @W-8208817@.
2020-11-12 13:45:27 +00:00
Ed Morley 41f657fbff Remove vendored jq binary (#1112)
Since `jq` is installed in the `-build` stack image for all stacks:
https://github.com/heroku/stack-images/pull/174

Closes @W-7974682@.
2020-11-10 15:34:56 +00:00
Ed Morley 9b1a69a1b3 Vendor buildpack-stdlib instead of fetching from S3 (#1100)
Since fetching buildpack-stdlib from S3 has a number of disadvantages:
- it's not possible to grep the repo when trying to work out what
  something from the stdlib is doing
- shellcheck can't fully scan the code, since it similarly doesn't
  have the source
- another compile-time HTTP request that can fail due to transient
  network issues and so reduce reliability
- dependency on the security/release-process of an additional bucket

Since the stdlib is small, doesn't often change, and is not a binary,
it's a great fit for just vendoring in the repo.

The `BIN_DIR` calculation added to `bin/utils` is based on the approach
mentioned here:
https://www.ostricher.com/2014/10/the-right-way-to-get-the-directory-of-a-bash-script/

...rather than copying the version in `bin/compile`, since the latter uses
`$0` so doesn't work with sourced scripts (such as `bin/utils`).

Closes W-8094463.
2020-10-19 12:27:16 +01:00
Ed Morley 4e78b5d57c Remove duplicate copy of shunit2 (#1086)
The tests use `test/shunit2` so the copy under `vendor/` is redundant.

I've added to the CHANGELOG since `vendor/` is added by the buildpack to
`PATH` (something long term we should stop doing), increasing the chance
an app was accidentally relying upon `shunit2` (albeit still unlikely).

Closes @W-8145517@.
2020-10-01 16:02:09 +01:00
Ed Morley ac29db32f8 Remove unused vendor/test-utils (#1043)
Since the unit tests instead use the utilities in this separate file:
https://github.com/heroku/heroku-buildpack-python/blob/419ef479969c4d5945f2c0620292229ef464f4c8/test/utils

A changelog entry has been added since whilst this file is for internal
testing only, the buildpack's `vendor/` directory is put on `PATH`, so
in theory it could have been called outside the buildpack (though this
seems extremely unlikely since the script isn't very useful externally).

Fixes #1027.
Closes @W-7918496@.
2020-08-11 19:31:07 +01:00
Ed Morley 31e8f48db8 Install setuptools from PyPI rather than a vendored copy (#1007)
Since:
* we'll be updating setuptools soon, and newer setuptools has dropped
  support for Python versions this buildpack needs to support. As such
  if we continued to vendor setuptools, we would need to vendor at
  least three different versions.
* we want to try and update setuptools more frequently than we have
  in the past, which will mean more repo bloat from binary churn.
* we're still pinning to a specific version, meaning vendoring doesn't
  have determinism benefits.
* setuptools is only fetched from PyPI for new installs (or where
  versions have changed), so this doesn't increase build time, load on
  PyPI, or reliance on PyPI in the common case.
* setuptools is already being inadvertently installed from PyPI prior to
  being installed from the vendored copy (see #1001), so we're in effect
  already using/depending on PyPI here.
* switching to storing setuptools on S3 wouldn't help reliability as
  much as it would appear at first glance, since the later `pip install`
  of customer dependencies will fail if PyPI is down anyway.
2020-07-29 19:11:35 +01:00
Claudio Jolowicz 468d27ab98 Adapt pip-pop to changes in pip >= 10
The pip-diff and pip-grep tools from the vendorized `pip-pop` package
import internal modules from pip. In pip >= 10, internal modules were
moved under `pip._internal`, breaking the imports. Use `try...except
ImportError` to handle both import paths.

Also, the interface of the `PackageFinder` class from one of these
modules changed. Provide a wrapper function to allow creating objects of
this type using the old interface.
2019-11-24 15:43:13 +01:00
Casey Faist 5df70ce26c remove get-pip from repo 2019-09-11 13:37:18 -07:00
Pradeep Damodara af7332b5b2 Update pipenv-to-pip to read lockfiles properly
Use the appropriate encoding to read a Pipfile.lock so we can
properly load the data.

Closes #678
2018-05-07 14:47:45 -05:00
kennethreitz 23400d7862 update pip installation method, to include setuptools 2018-03-20 13:20:49 -04:00
kennethreitz 05e3d8ccce fix mercurial step
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
2018-03-07 11:08:13 -05:00
kennethreitz fe302d8724 don't expect there to be a requirements.txt
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
2018-03-07 10:51:48 -05:00
kennethreitz 0f0ddd52ea don't suppress error messages
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
2018-03-07 10:50:03 -05:00
kennethreitz 97ac451a80 Pipenv uninstall, and other improvements (#650) 2018-03-06 15:44:50 -05:00
kennethreitz 23ee27792a Update python.gunicorn.sh (#628) 2018-01-10 12:21:39 -05:00
Robin Richtsfeld 88d6c93955 Fix some Bash issues (#491) 2017-12-15 09:19:03 -05:00
kennethreitz b261158bf2 Make gunicorn default access log to stdout (#490)
* make gunicorn default access log to stdout

* Update python.gunicorn.sh
2017-12-13 13:12:26 -05:00
Jeremy Morrell 325a3165e4 Remove leading zeros from WEB_CONCURRENCY (#446)
* Remove leading zeros from `WEB_CONCURRENCY`

* fix DYNO_RAM (from node buildpack)

Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
2017-08-10 14:42:45 -04:00
kennethreitz 4ee3baaded Revert "Don't install packages that could mess packaging up" (#404)
* Revert "Fix pyyaml (#402)"

This reverts commit ff94908505.

* Revert "Don't install packages that could mess packaging up (#397)"

This reverts commit 5496c02f9f.
2017-06-03 17:36:19 -04:00
kennethreitz ff94908505 Fix pyyaml (#402)
* Revert "use pkg_resources to check for distributions (#395)"

This reverts commit 9b185f99d5.

* use sp-grep for django detection

* sp-grep

* fix setuptools script
2017-06-02 15:23:05 -04:00
kennethreitz 5496c02f9f Don't install packages that could mess packaging up (#397)
* updated changelog

* remove setuptools sanity check

* update changelog

* pip-clean

* changelog note

* refactor codebase to improve package name detection

* fix version string

* cleanup

* add messaging, improve execution

* do uninstall first
2017-05-30 20:03:57 -04:00
David Lord 9b185f99d5 use pkg_resources to check for distributions (#395)
more accurate than parsing requirements.txt
fixes #359
2017-05-30 11:05:33 -04:00
kennethreitz 84f2fb5396 update python.gunicorn.sh to WEB_CONCURRENCY.sh (#373)
* update python.gunicorn.sh to WEB_CONCURRENCY.sh

* don't remove WEB_CONCURRENCY for prefixed 0s

* split gunicorn functionality into its own file

* cleanup comments

* fix var ordering

* add retry to curl

* use proper url for buildpack stdlib
2017-05-05 14:28:00 -04:00
kennethreitz 26ed6daeaa remove bpwatch 2017-03-17 14:12:18 -04:00
kennethreitz cafd418220 remove bunk file 2017-03-16 13:23:39 -04:00
kennethreitz 45b0d18532 fix tests further 2017-03-16 12:29:07 -04:00
kennethreitz 8f258ae0b8 remove pipstrip 2017-03-16 12:16:59 -04:00
kennethreitz c19f0f83ee fix build 2017-03-15 23:54:59 -04:00
kennethreitz 44c2b75b8d fix runtime-fixer 2017-03-14 13:36:29 -04:00
kennethreitz c3849fb6d3 improvements 2017-03-14 13:36:14 -04:00
kennethreitz e9108858fc v100 2017-03-14 11:59:39 -04:00
kennethreitz dcfff15151 cleanups 2017-03-14 11:23:28 -04:00
kennethreitz a547da0b52 oops 2017-03-14 10:47:26 -04:00
kennethreitz df52fd46e5 whitespace stripper for runtime.txt 2017-03-14 10:45:59 -04:00
kennethreitz 2df1131d3c remove bpwatch 2017-03-10 11:21:57 -05:00
kennethreitz 09b7e44841 fix tests 2017-03-08 16:57:33 -05:00
kennethreitz 893bdec066 updated setuptools 2017-03-08 08:44:32 -05:00
kennethreitz 35b89386ed Squashed commit of the following:
commit 1b6199c182a8cf453247ae2a19b7f1db71664dda
Author: Kenneth Reitz <me@kennethreitz.org>
Date:   Thu Mar 2 22:10:46 2017 -0800

    remove toml.py

commit e9215a30f111008b97ac50584a077b77585fda4a
Author: Kenneth Reitz <me@kennethreitz.org>
Date:   Thu Mar 2 21:58:59 2017 -0800

    fuck

commit d1f40a51aa01a7f2771cbac32543e9df021939a1
Author: Kenneth Reitz <me@kennethreitz.org>
Date:   Thu Mar 2 21:58:06 2017 -0800

    frost mirror

commit 0f1ec08f8fd88d9b7ebe5b17ad3cf75a7e2859dd
Author: Kenneth Reitz <me@kennethreitz.org>
Date:   Thu Mar 2 21:45:40 2017 -0800

    hmmmm

commit 9e2e857371029f3e9569a6cbfb71e5162a991339
Author: Kenneth Reitz <me@kennethreitz.org>
Date:   Thu Mar 2 21:44:30 2017 -0800

    hmmm

commit 892ba8bfcda54db993a10546970ccfe17c3fe51d
Author: Kenneth Reitz <me@kennethreitz.org>
Date:   Thu Mar 2 21:37:46 2017 -0800

    that

commit 61f80e7f5e380e8d6237adc1589a075f2974139b
Author: Kenneth Reitz <me@kennethreitz.org>
Date:   Thu Mar 2 21:36:41 2017 -0800

    this

commit 18a6f91ef5ff4410de43c562fffee99a0fb45da0
Author: Kenneth Reitz <me@kennethreitz.org>
Date:   Thu Mar 2 21:35:32 2017 -0800

    this

commit 163acc77e59cd34ec09a0d9836bbc20448e857ad
Author: Kenneth Reitz <me@kennethreitz.org>
Date:   Thu Mar 2 21:31:53 2017 -0800

    this

commit 4af63049cd1f6ced6daf1da43b15ef98ade84497
Author: Kenneth Reitz <me@kennethreitz.org>
Date:   Thu Mar 2 21:30:52 2017 -0800

    this

commit 43bde00a088a3a5b0db3d6361b24a679e5690e8e
Author: Kenneth Reitz <me@kennethreitz.org>
Date:   Thu Mar 2 14:59:04 2017 -0800

    olive garden

commit 24305ba1b2938f3d373d0c8d158c2137eb709c82
Author: Kenneth Reitz <me@kennethreitz.org>
Date:   Thu Mar 2 14:57:52 2017 -0800

    change

commit dff928b2299679ebdee08f4e82b8815b7cbbf419
Author: Kenneth Reitz <me@kennethreitz.org>
Date:   Wed Mar 1 19:55:22 2017 -0800

    hmmm

commit e3bc14ff9085c2a0e5939693bc71930c4e299f27
Author: Kenneth Reitz <me@kennethreitz.org>
Date:   Wed Mar 1 19:45:29 2017 -0800

    pipstrip

commit 8dd06e437bb8b519d434805aa923adfd20fb0086
Author: Kenneth Reitz <me@kennethreitz.org>
Date:   Wed Mar 1 19:37:43 2017 -0800

    changes

commit 3abaaa9b9fb9b3fdd3cbd9dc2ade25f282555a65
Author: Kenneth Reitz <me@kennethreitz.org>
Date:   Wed Mar 1 19:33:59 2017 -0800

    changes

commit 61aeea92418f934ac79e189cde69bcb9e74413fe
Author: Kenneth Reitz <me@kennethreitz.org>
Date:   Wed Mar 1 19:28:15 2017 -0800

    changes

commit 9219f38ac9f56c55e0030f55dbfdd5f55ae050de
Author: Kenneth Reitz <me@kennethreitz.org>
Date:   Wed Mar 1 19:27:37 2017 -0800

    changes

commit 390f40102b946a17f58697db42edc3d6d06f6581
Author: Kenneth Reitz <me@kennethreitz.org>
Date:   Wed Mar 1 19:26:31 2017 -0800

    changes

commit bdb0710e4554764f66a753c28f260af564ef6d6a
Author: Kenneth Reitz <me@kennethreitz.org>
Date:   Wed Mar 1 19:25:24 2017 -0800

    changes

commit 3af273e7ed56a5fdec6f5986f27b4ca5312861e1
Author: Kenneth Reitz <me@kennethreitz.org>
Date:   Wed Mar 1 19:24:15 2017 -0800

    changes

commit 250632c245bcba9bb331e6ad7b6d1afd5ddc34c5
Author: Kenneth Reitz <me@kennethreitz.org>
Date:   Wed Mar 1 19:23:06 2017 -0800

    changes

commit 5c9a637a75aaf20087e80114607cc15f00b39ff3
Author: Kenneth Reitz <me@kennethreitz.org>
Date:   Wed Mar 1 19:16:47 2017 -0800

    toml.py

commit f672922a7bc09e9d7a2c559bb6be1e718703c459
Author: Kenneth Reitz <me@kennethreitz.org>
Date:   Wed Mar 1 19:15:26 2017 -0800

    vendor dir

commit 67d44200454510c3a625257909f7e708778359ec
Author: Kenneth Reitz <me@kennethreitz.org>
Date:   Wed Mar 1 19:14:45 2017 -0800

    change

commit 12dc70d7d91ce57944e221591cf3bf3bef0e0a0c
Author: Kenneth Reitz <me@kennethreitz.org>
Date:   Wed Mar 1 19:12:57 2017 -0800

    changes

commit 25673345579e8f1d7394b9ba60682f97be63273b
Author: Kenneth Reitz <me@kennethreitz.org>
Date:   Wed Mar 1 19:12:28 2017 -0800

    this

commit a4a5a6d006197158a511677d3aae25183531ff3e
Author: Kenneth Reitz <me@kennethreitz.org>
Date:   Wed Mar 1 19:07:19 2017 -0800

    changes

commit 49c2c9ab901aaa4cd9c8c168f5b388b032708e51
Author: Kenneth Reitz <me@kennethreitz.org>
Date:   Wed Mar 1 19:05:03 2017 -0800

    changes

commit 2d3223d95968408889d79f722df7628b9e4533c8
Author: Kenneth Reitz <me@kennethreitz.org>
Date:   Wed Mar 1 19:04:24 2017 -0800

    changes

commit 6334b0f62afcbb3bc91bb706d30e6dd9aadfe447
Author: Kenneth Reitz <me@kennethreitz.org>
Date:   Wed Mar 1 19:02:35 2017 -0800

    detect python version

commit df606fa0aeed0754e659cce41fa28a88c471c756
Author: Kenneth Reitz <me@kennethreitz.org>
Date:   Wed Mar 1 18:56:08 2017 -0800

    hide stderr

commit 7ac261f62ee6c38e709a1560baadc181494b97db
Author: Kenneth Reitz <me@kennethreitz.org>
Date:   Wed Mar 1 18:53:37 2017 -0800

    update

commit f8530d252c2b386fb9f65a991d94380d3eccfdfd
Author: Kenneth Reitz <me@kennethreitz.org>
Date:   Wed Mar 1 18:51:46 2017 -0800

    lock

commit 7a1e10034a591890aa16c6e34ba5cb3d6b90a7b7
Author: Kenneth Reitz <me@kennethreitz.org>
Date:   Wed Mar 1 18:50:53 2017 -0800

    just generate requriements file

commit d78630ff858394cbae8397e1d060a3cc2437943f
Merge: 766b0c6 66f5a66
Author: Kenneth Reitz <me@kennethreitz.org>
Date:   Wed Mar 1 18:49:04 2017 -0800

    Merge branch 'master' into pipenv

commit 766b0c66e742790dc45df73e021302cf18601947
Author: Kenneth Reitz <me@kennethreitz.org>
Date:   Wed Mar 1 18:47:42 2017 -0800

    semicolon wrong

commit a9017bce79a4075ed1682041ca19c54092be71bb
Author: Kenneth Reitz <me@kennethreitz.org>
Date:   Wed Mar 1 18:41:54 2017 -0800

    run pipenv

commit 651c3aa90e45aa9f7509b127e4a21110907974cf
Author: Kenneth Reitz <me@kennethreitz.org>
Date:   Wed Mar 1 18:41:45 2017 -0800

    detect on pipfile

commit 6d9f553e24b82e756dd4c02063da035025144c9b
Author: Kenneth Reitz <me@kennethreitz.org>
Date:   Wed Mar 1 18:41:37 2017 -0800

    pipenv step

commit 51c6ef3060ac707bcb0361ccbbcfca50035a4360
Author: Kenneth Reitz <me@kennethreitz.org>
Date:   Wed Mar 1 18:41:26 2017 -0800

    new vendors
2017-03-02 22:11:03 -08:00
David Zülke acd9347930 Handle and produce leading 0 in WEB_CONCURRENCY (#355)
The Node buildpack now exports a leading zero in its numbers. This lets us detect that it (or another buildpack) set the value, and overwrite it accordingly.

Fixes the issue where adding the node buildpack to a Python app would cause only one gunicorn worker to be spawned for a 1X dyno, and not two.

We also need to again produce leading zeroes in the value, so that e.g. the PHP buildpack can do the same on boot.
2017-01-23 01:29:02 -05:00
kennethreitz 26b2eeee20 update setuptools to v31.1.0 2016-12-17 18:58:32 -05:00
kennethreitz d1c30fd24b updated pip and setuptools 2016-11-15 09:39:29 -05:00
kennethreitz 0cf2e2849d updated setuptools vendor 2016-08-17 02:01:39 -04:00
Ed Morley 39f2efe296 Remove vendored pip since pip-pop is now compatible with pip v8
This means pip-pop will use the buildpack-installed pip 8, which doesn't
fail when encountering requirements files that use the new hash syntax.

Fixes #302.
2016-07-11 10:48:49 +01:00
Ed Morley d047f26ad4 Import upstream pip-pop fix for pip 8 support
Is the fix from kennethreitz/pip-pop#12.
2016-07-11 10:48:49 +01:00
cclauss 692f040618 Update default Python plus Pip and Setuptools
* $ curl
https://pypi.python.org/packages/e7/a8/7556133689add8d1a54c0b14aeff0acb0
3c64707ce100ecd53934da1aa13/pip-8.1.2.tar.gz -o pip-8.1.2.tar.gz
* $ curl
https://pypi.python.org/packages/9f/7c/0a33c528164f1b7ff8cf0684cf88c2e73
3c8ae0119ceca4a3955c7fc059d/setuptools-23.1.0.tar.gz -o
setuptools-23.1.0.tar.gz
* $ ls
* $ rm pip-8.1.1.tar.gz
* $ rm setuptools-20.4.tar.gz
2016-06-28 10:56:09 +02:00
Chad Whitacre a84fc7a248 clean up pip-pop in the not silent case
The extraneous `format` call is harmless in itself, but it's possible for `requirement.req` to be `None` here, which results in `AttributeError: 'NoneType' object has no attribute 'project_name'`.
2016-05-10 07:31:25 -04:00
kennethreitz 0b7a1fc14e use older pip for pip-pop 2016-03-31 18:08:49 -04:00
kennethreitz 2c69e3b98f setuptools v20.4 2016-03-30 18:20:04 -04:00