pyre: remove

Every other version update of pyre is non-trivial and requires
specific versions which blocks updates elsewhere. Removing now,
we can re-import when pyre has settled down.
This commit is contained in:
Tom Hunger 2019-09-29 09:54:04 +01:00 committed by Lassulus
parent 43fe77c0e8
commit fa4b5185b3
3 changed files with 0 additions and 182 deletions

View file

@ -1,137 +0,0 @@
{ stdenv, fetchFromGitHub, ocamlPackages, writeScript
, dune, python3, rsync, buck, watchman, sqlite }:
let
# Manually set version - the setup script requires
# hg and git + keeping the .git directory around.
pyre-version = "0.0.22"; # also change typeshed revision below with $pyre-src/.typeshed-version
pyre-src = fetchFromGitHub {
owner = "facebook";
repo = "pyre-check";
rev = "v${pyre-version}";
sha256 = "057vy6zmgwsi0ag9n4m6sszhahmfk2s1ywm36nyfs7w4d0wnk92s";
};
versionFile = writeScript "version.ml" ''
cat > "./version.ml" <<EOF
open Core
let build_info () =
"pyre-nixpkgs ${pyre-version}"
let version () =
"${pyre-version}"
let log_version_banner () =
Log.info "Running as pid: %d" (Pid.to_int (Unix.getpid ()));
Log.info "Version: %s" (version ());
Log.info "Build info: %s" (build_info ())
EOF
'';
pyre-bin = stdenv.mkDerivation {
name = "pyre-${pyre-version}";
src = pyre-src;
buildInputs = with ocamlPackages; [
ocaml
findlib
menhir
yojson
core
sedlex
ppx_deriving_yojson
ocamlbuild
ppxlib
dune
ounit
base64
sqlite.dev
# python36Packages.python36Full # TODO
];
preBuild = ''
# build requires HOME to be set
export HOME=$TMPDIR
# "external" because https://github.com/facebook/pyre-check/pull/8/files
sed "s/%VERSION%/external/" dune.in > dune
ln -sf ${versionFile} ./scripts/generate-version-number.sh
mkdir $(pwd)/build
export OCAMLFIND_DESTDIR=$(pwd)/build
export OCAMLPATH=$OCAMLPATH:$(pwd)/build
'';
buildFlags = [ "release" ];
doCheck = true;
# ./scripts/run-python-tests.sh # TODO: once typeshed and python bits are added
# Note that we're not installing the typeshed yet.
# Improvement for a future version.
installPhase = ''
install -D ./_build/default/main.exe $out/bin/pyre.bin
'';
meta = with stdenv.lib; {
description = "A performant type-checker for Python 3";
homepage = https://pyre-check.org;
license = licenses.mit;
platforms = ocamlPackages.ocaml.meta.platforms;
maintainers = with maintainers; [ teh ];
};
};
typeshed = stdenv.mkDerivation {
pname = "typeshed";
version = pyre-version;
src = fetchFromGitHub {
owner = "python";
repo = "typeshed";
rev = "0b49ce75b478fdf283dda5dd1368759ac342dfe2";
sha256 = "1w5aqbbcfk5ki8n9fgdikkyadjb318ipqyi517s9xnwlzi1jv0fh";
};
phases = [ "unpackPhase" "installPhase" ];
installPhase = "cp -r $src $out";
};
in python3.pkgs.buildPythonApplication {
pname = "pyre-check";
version = pyre-version;
src = pyre-src;
patches = [ ./pyre-bdist-wheel.patch ];
# The build-pypi-package script does some funky stuff with build
# directories - easier to patch it a bit than to replace it
# completely though:
postPatch = ''
mkdir ./build
substituteInPlace scripts/build-pypi-package.sh \
--replace 'NIX_BINARY_FILE' '${pyre-bin}/bin/pyre.bin' \
--replace 'BUILD_ROOT="$(mktemp -d)"' "BUILD_ROOT=$PWD/build"
for file in client/pyre.py client/commands/initialize.py client/commands/tests/initialize_test.py; do
substituteInPlace "$file" \
--replace '"watchman"' '"${watchman}/bin/watchman"'
done
substituteInPlace client/buck.py \
--replace '"buck"' '"${buck}/bin/buck"'
substituteInPlace client/tests/buck_test.py \
--replace '"buck"' '"${buck}/bin/buck"'
'';
buildInputs = [ pyre-bin ];
nativeBuildInputs = [ rsync ]; # only required for build-pypi-package.sh
propagatedBuildInputs = with python3.pkgs; [
docutils
typeshed
click-log
ipython
sqlalchemy
munch
xxhash
ujson
];
buildPhase = ''
bash scripts/build-pypi-package.sh --version ${pyre-version} --bundle-typeshed ${typeshed}
cp -r build/dist dist
'';
checkPhase = ''
bash scripts/run-python-tests.sh
'';
}

View file

@ -1,43 +0,0 @@
diff --git a/scripts/build-pypi-package.sh b/scripts/build-pypi-package.sh
index 1035591..bb8cbae 100755
--- a/scripts/build-pypi-package.sh
+++ b/scripts/build-pypi-package.sh
@@ -98,7 +98,7 @@ rsync -avm --filter='- tests/' --filter='+ */' --filter='-! *.py' "${SCRIPTS_DIR
sed -i -e "/__version__/s/= \".*\"/= \"${PACKAGE_VERSION}\"/" "${BUILD_ROOT}/${MODULE_NAME}/version.py"
# Copy binary files.
-BINARY_FILE="${SCRIPTS_DIRECTORY}/../_build/default/main.exe"
+BINARY_FILE="NIX_BINARY_FILE"
if [[ ! -f "${BINARY_FILE}" ]]; then
echo "The binary file ${BINARY_FILE} does not exist."
echo "Have you run 'make' in the toplevel directory?"
@@ -146,7 +146,7 @@ def find_typeshed_files(base):
result.append((target, files))
return result
-with open('README.md') as f:
+with open('README.md', encoding='utf8') as f:
long_description = f.read()
setup(
@@ -205,20 +205,3 @@ fi
# Build.
python3 setup.py bdist_wheel
-
-# Move artifact outside the build directory.
-mkdir -p "${SCRIPTS_DIRECTORY}/dist"
-files_count="$(find "${BUILD_ROOT}/dist/" -type f | wc -l | tr -d ' ')"
-[[ "${files_count}" == '1' ]] || \
- die "${files_count} files created in ${BUILD_ROOT}/dist, but only one was expected"
-source_file="$(find "${BUILD_ROOT}/dist/" -type f)"
-destination="$(basename "${source_file}")"
-destination="${destination/%-any.whl/-${WHEEL_DISTRIBUTION_PLATFORM}.whl}"
-mv "${source_file}" "${SCRIPTS_DIRECTORY}/dist/${destination}"
-
-# Cleanup.
-cd "${SCRIPTS_DIRECTORY}"
-rm -rf "${BUILD_ROOT}"
-
-printf '\nAll done. Build artifact available at:\n %s\n' "${SCRIPTS_DIRECTORY}/dist/${destination}"
-exit 0

View file

@ -7898,8 +7898,6 @@ in
fstar = callPackage ../development/compilers/fstar { };
pyre = callPackage ../development/tools/pyre { };
dotnetPackages = recurseIntoAttrs (callPackage ./dotnet-packages.nix {});
glslang = callPackage ../development/compilers/glslang {