mirror of
https://github.com/pyenv/pyenv-doctor.git
synced 2025-12-07 23:11:27 +09:00
create project
This commit is contained in:
commit
86b7f5eb04
7
.gitignore
vendored
Normal file
7
.gitignore
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
*.swo
|
||||
*.swp
|
||||
/Makefile
|
||||
/autom4te.cache
|
||||
/config.log
|
||||
/config.status
|
||||
/python
|
||||
20
LICENSE
Normal file
20
LICENSE
Normal file
@ -0,0 +1,20 @@
|
||||
Copyright (c) 2013 Yamashita, Yuu
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
10
Makefile.in
Normal file
10
Makefile.in
Normal file
@ -0,0 +1,10 @@
|
||||
PREFIX = @prefix@
|
||||
|
||||
.PHONY: install
|
||||
|
||||
python:
|
||||
echo '#!/bin/sh' > "$@"
|
||||
|
||||
install: python
|
||||
mkdir -p "$(PREFIX)/bin"
|
||||
install -m 755 $< "$(PREFIX)/bin/python"
|
||||
55
README.md
Normal file
55
README.md
Normal file
@ -0,0 +1,55 @@
|
||||
# pyenv-doctor
|
||||
|
||||
pyenv-doctor is a [pyenv](https://github.com/yyuu/pyenv) plugin
|
||||
that provides a `pyenv doctor` command to verify pyenv installation
|
||||
and development tools to build pythons.
|
||||
|
||||
## Installation
|
||||
|
||||
### Installing as a pyenv plugin
|
||||
|
||||
Installing pyenv-doctor as a pyenv plugin will give you access to the
|
||||
`pyenv doctor` command.
|
||||
|
||||
$ git clone git://github.com/yyuu/pyenv-doctor.git ~/.pyenv/plugins/pyenv-doctor
|
||||
|
||||
## Usage
|
||||
|
||||
To verify pyenv installation, just type `pyenv doctor`. By default, checking development tools to build CPython.
|
||||
|
||||
$ pyenv doctor
|
||||
|
||||
If you favor checking development tools to build Jython,
|
||||
|
||||
$ pyenv doctor --jython
|
||||
|
||||
## Version History
|
||||
|
||||
#### 20130611
|
||||
|
||||
* Initial public release.
|
||||
|
||||
### License
|
||||
|
||||
(The MIT License)
|
||||
|
||||
* Copyright (c) 2013 Yamashita, Yuu
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
178
bin/pyenv-doctor
Executable file
178
bin/pyenv-doctor
Executable file
@ -0,0 +1,178 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Summary: Verify pyenv installation and deevlopment tools to build pythons.
|
||||
#
|
||||
# Usage: pyenv doctor [OPTIONS]
|
||||
#
|
||||
# -a/--all Check all
|
||||
# -c/--cpython Check for CPython
|
||||
# -j/--jython Check for Jython
|
||||
# -p/--pypy Check for PyPy
|
||||
# -s/--stackless Check for Stackless Python
|
||||
# -v/--verbose Increase verbosity
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
[ -n "$PYENV_DEBUG" ] && set -x
|
||||
|
||||
if [ -z "$PYENV_ROOT" ]; then
|
||||
PYENV_ROOT="${HOME}/.pyenv"
|
||||
fi
|
||||
|
||||
parse_options() {
|
||||
OPTIONS=()
|
||||
ARGUMENTS=()
|
||||
local arg option index
|
||||
|
||||
for arg in "$@"; do
|
||||
if [ "${arg:0:1}" = "-" ]; then
|
||||
if [ "${arg:1:1}" = "-" ]; then
|
||||
OPTIONS[${#OPTIONS[*]}]="${arg:2}"
|
||||
else
|
||||
index=1
|
||||
while option="${arg:$index:1}"; do
|
||||
[ -n "$option" ] || break
|
||||
OPTIONS[${#OPTIONS[*]}]="$option"
|
||||
index=$(($index+1))
|
||||
done
|
||||
fi
|
||||
else
|
||||
ARGUMENTS[${#ARGUMENTS[*]}]="$arg"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
resolve_link() {
|
||||
$(type -p greadlink readlink | head -1) "$1"
|
||||
}
|
||||
|
||||
abs_dirname() {
|
||||
local cwd="$(pwd)"
|
||||
local path="$1"
|
||||
|
||||
while [ -n "$path" ]; do
|
||||
cd "${path%/*}"
|
||||
local name="${path##*/}"
|
||||
path="$(resolve_link "$name" || true)"
|
||||
done
|
||||
|
||||
pwd
|
||||
cd "$cwd"
|
||||
}
|
||||
|
||||
usage() {
|
||||
{ echo "usage: pyenv-doctor [-v|--verbose] [-a|--all] [-c|--cpython] [-j|--jython] [-p|--pypy] [-s|--stackless]"
|
||||
} >&2
|
||||
exit "${1:-1}"
|
||||
}
|
||||
|
||||
unset WITH_ALL
|
||||
unset WITH_CPYTHON
|
||||
unset WITH_JYTHON
|
||||
unset WITH_PYPY
|
||||
unset WITH_STACKLESS
|
||||
PYENV_DOCTOR_ROOT="$(abs_dirname "$0")/.."
|
||||
unset VERBOSE
|
||||
|
||||
parse_options "$@"
|
||||
|
||||
for option in "${OPTIONS[@]}"; do
|
||||
case "$option" in
|
||||
"a" | "all" )
|
||||
WITH_ALL=true
|
||||
;;
|
||||
"c" | "cpython" )
|
||||
WITH_CPYTHON=true
|
||||
;;
|
||||
"h" | "help" )
|
||||
usage 0
|
||||
;;
|
||||
"j" | "jython" )
|
||||
WITH_JYTHON=true
|
||||
;;
|
||||
"p" | "pypy" )
|
||||
WITH_PYPY=true
|
||||
;;
|
||||
"s" | "stackless" )
|
||||
WITH_STACKLESS=true
|
||||
;;
|
||||
"v" | "verbose" )
|
||||
VERBOSE="-v"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -z "$TMPDIR" ]; then
|
||||
TMP="/tmp"
|
||||
else
|
||||
TMP="${TMPDIR%/}"
|
||||
fi
|
||||
|
||||
SEED="$(date "+%Y%m%d%H%M%S").$$"
|
||||
BUILD_PATH="${TMP}/pyenv-doctor.${SEED}"
|
||||
|
||||
if ! command -v git 1>/dev/null 2>&1; then
|
||||
echo "pyenv: git is not installed." 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! command -v python-build 1>/dev/null 2>&1; then
|
||||
echo "pyenv: python-build is not installed." 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
DEFINITION="${BUILD_PATH}/definition"
|
||||
PREFIX="${BUILD_PATH}/prefix"
|
||||
REPOSITORY="${PYENV_DOCTOR_ROOT}"
|
||||
BRANCH="$(cd "${PYENV_DOCTOR_ROOT}" && git name-rev --name-only HEAD)"
|
||||
mkdir -p "${BUILD_PATH}"
|
||||
cat <<EOF > "${DEFINITION}"
|
||||
install_git "pyenv-doctor" "${REPOSITORY}" "${BRANCH}" standard
|
||||
EOF
|
||||
|
||||
# if none is selected, check as WITH_CPYTHON
|
||||
if [ -z "${WITH_JYTHON}" ] && [ -z "${WITH_PYPY}" ] && [ -z "${WITH_STACKLESS}" ]; then
|
||||
WITH_CPYTHON=true
|
||||
fi
|
||||
|
||||
if [ -n "${WITH_ALL}" ] || [ -n "${WITH_CPYTHON}" ]; then
|
||||
export CONFIGURE_OPTS+="--with-cpython"
|
||||
fi
|
||||
if [ -n "${WITH_ALL}" ] || [ -n "${WITH_JYTHON}" ]; then
|
||||
export CONFIGURE_OPTS+="--with-jython"
|
||||
fi
|
||||
if [ -n "${WITH_ALL}" ] || [ -n "${WITH_PYPY}" ]; then
|
||||
export CONFIGURE_OPTS+="--with-pypy"
|
||||
fi
|
||||
if [ -n "${WITH_ALL}" ] || [ -n "${WITH_STACKLESS}" ]; then
|
||||
export CONFIGURE_OPTS+="--with-stackless"
|
||||
fi
|
||||
|
||||
case "$(uname -s)" in
|
||||
"Darwin" )
|
||||
## ld(1) on Mac OS X searches /usr/lib first of /usr/local/lib.
|
||||
## to override system libraries installed in /usr/lib,
|
||||
## we must explicitly specify the library path in "-L".
|
||||
if command -v brew 1>/dev/null 2>&1; then # Homebrew
|
||||
[ -d "/usr/local/include" ] && export CFLAGS+="-I/usr/local/include"
|
||||
[ -d "/usr/local/lib" ] && export LDFLAGS+="-L/usr/local/lib"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
STATUS=0
|
||||
python-build $VERBOSE "${DEFINITION}" "${PREFIX}" || STATUS="$?"
|
||||
|
||||
if [ "${STATUS}" == "0" ]; then
|
||||
echo -e "\033[0;32mCongratulations! You are ready to build pythons!\033[0m"
|
||||
else
|
||||
{ echo -e "\033[0;31mProblem(s) detected while checking system.\033[0m"
|
||||
echo -e "\033[0;31m\033[0m"
|
||||
echo -e "\033[0;31mSee https://github.com/yyuu/pyenv/wiki/Common-build-problems for known solutions.\033[0m"
|
||||
} 1>&2
|
||||
fi
|
||||
|
||||
rm -fr "${BUILD_PATH}"
|
||||
|
||||
exit "${STATUS}"
|
||||
78
configure.ac
Normal file
78
configure.ac
Normal file
@ -0,0 +1,78 @@
|
||||
AC_PREREQ([2.69])
|
||||
AC_INIT(pyenv-doctor, 0.0.1, yamashita@geishatokyo.com)
|
||||
|
||||
AC_ARG_WITH([cpython], AC_HELP_STRING([--with-cpython], [check toolchain for CPython]), [WITH_CPYTHON=yes])
|
||||
AC_ARG_WITH([jython], AC_HELP_STRING([--with-jython], [check toolchain for Jython]), [WITH_JYTHON=yes])
|
||||
AC_ARG_WITH([pypy], AC_HELP_STRING([--with-pypy], [check toolchain for PyPy]), [WITH_PYPY=yes])
|
||||
AC_ARG_WITH([stackless], AC_HELP_STRING([--with-stackless], [check toolchain for Stackless Python]), [WITH_STACKLESS=yes])
|
||||
|
||||
if ( test -n "$WITH_CPYTHON" || test -n "$WITH_PYPY" || test -n "$WITH_STACKLESS" ); then
|
||||
AC_PROG_CC
|
||||
fi
|
||||
|
||||
if ( test -n "$WITH_JYTHON" ); then
|
||||
AC_CHECK_PROG(JAVA, java, java, no)
|
||||
if test "$JAVA" = "no"; then
|
||||
AC_MSG_ERROR([java is not installed.])
|
||||
fi
|
||||
|
||||
AC_CHECK_PROG(ANT, ant, ant, no)
|
||||
if test "$ANT" = "no"; then
|
||||
AC_MSG_ERROR([ant is not installed.])
|
||||
fi
|
||||
fi
|
||||
|
||||
if ( test -n "$WITH_CPYTHON" || test -n "$WITH_PYPY" || test -n "$WITH_STACKLESS" ); then
|
||||
## GNU readline
|
||||
AC_CHECK_LIB(readline, rl_gnu_readline_p, [HAVE_LIBREADLINE=yes], [HAVE_LIBREADLINE=no])
|
||||
if test "$HAVE_LIBREADLINE" = "no"; then
|
||||
AC_MSG_ERROR([GNU readline is not installed.])
|
||||
fi
|
||||
AC_CHECK_HEADERS(readline/readline.h, [HAVE_READLINE_H=yes], [HAVE_READLINE_H=no])
|
||||
if test "$HAVE_READLINE_H" = "no"; then
|
||||
AC_MSG_ERROR([GNU readline development header is not installed.])
|
||||
fi
|
||||
|
||||
## OpenSSL
|
||||
AC_CHECK_LIB(ssl, SSL_library_init, [HAVE_LIBSSL=yes], [HAVE_LIBSSL=no])
|
||||
if test "$HAVE_LIBSSL" = "no"; then
|
||||
AC_MSG_ERROR([OpenSSL is not installed.])
|
||||
fi
|
||||
AC_CHECK_HEADERS(openssl/ssl.h, [HAVE_SSL_H=yes], [HAVE_SSL_H=no])
|
||||
if test "$HAVE_SSL_H" = "no"; then
|
||||
AC_MSG_ERROR([OpenSSL development header is not installed.])
|
||||
fi
|
||||
|
||||
## bzip2
|
||||
AC_CHECK_LIB(bz2, BZ2_bzCompressInit, [HAVE_LIBBZ2=yes], [HAVE_LIBBZ2=no])
|
||||
if test "$HAVE_LIBBZ2" = "no"; then
|
||||
AC_MSG_ERROR([bzip2 is not installed.])
|
||||
fi
|
||||
AC_CHECK_HEADERS(bzlib.h, [HAVE_BZLIB_H=yes], [HAVE_BZLIB_H=no])
|
||||
if test "$HAVE_BZLIB_H" = "no"; then
|
||||
AC_MSG_ERROR([bzip2 development header is not installed.])
|
||||
fi
|
||||
|
||||
## zlib
|
||||
AC_CHECK_LIB(z, zlibVersion, [HAVE_LIBZ=yes], [HAVE_LIBZ=no])
|
||||
if test "$HAVE_LIBZ" = "no"; then
|
||||
AC_MSG_ERROR([zlib is not installed.])
|
||||
fi
|
||||
AC_CHECK_HEADERS(zlib.h, [HAVE_ZLIB_H=yes], [HAVE_ZLIB_H=no])
|
||||
if test "$HAVE_ZLIB_H" = "no"; then
|
||||
AC_MSG_ERROR([zlib development header is not installed.])
|
||||
fi
|
||||
|
||||
## SQLite3
|
||||
AC_CHECK_LIB(sqlite3, sqlite3_initialize, [HAVE_LIBSQLITE3=yes], [HAVE_LIBSQLITE3=no])
|
||||
if test "$HAVE_LIBSQLITE3" = "no"; then
|
||||
AC_MSG_ERROR([SQLite3 is not installed.])
|
||||
fi
|
||||
AC_CHECK_HEADERS(sqlite3.h, [HAVE_SQLITE3_H=yes], [HAVE_SQLITE3_H=no])
|
||||
if test "$HAVE_SQLITE3_H" = "no"; then
|
||||
AC_MSG_ERROR([SQLite3 development header is not installed.])
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_CONFIG_FILES([Makefile])
|
||||
AC_OUTPUT
|
||||
Loading…
x
Reference in New Issue
Block a user