on master help sign in
12 files changed+134−30
since splitsnapshots
unifiedsplit
README.md+17−1 build-prybar.nix+4−5 flake.lock+8−8 flake.nix+71−8 languages/julia/main.go+1−1 languages/python310/.gitignore+3 languages/python310/compile+9 run_tests+3−2 run_tests_language+2−3 scripts/docker-install.sh+14 tests/nodejs/err.exp+1−1 tests/nodejs/prompt_no_tty.exp+1−1
README.md+17−1
@@ -50,19 +50,35 @@ written in the host language which starts a Prybar-compatible REPL.
5050| SQLite | ✔ | ✔ | ✔ | ✔ | ✗ | ✔ |
5151| Tcl | ✔ | ✔ | ✔ | ✗ | ✗ | - |
5252
53+## Start to Develop with Nix
54+
55+To get started developing Prybar, you can use the nix shell. Enter
56+
57+```
58+nix develop
59+```
60+
61+to drop into a shell that has all dependencies installed an ready to go.
62+
63+If you don't have nix yet, install that: https://nixos.org/
64+
5365## Build and run
5466
5567 % make help
5668 usage:
5769 make all Build all Prybar binaries
5870 make prybar-LANG Build the Prybar binary for LANG
59− make docker Run a shell with Prybar inside Docker
71+ make docker Run a shell with Prybar inside Docker
72+ (don't do this in the nix shell, although this is
73+ not needed if you use nix)
6074 make image Build a Docker image with Prybar for distribution
6175 make test Run integration tests
6276 make test-image Test Docker image for distribution
6377 make clean Remove build artifacts
6478 make help Show this message
6579
80+## You can also use Docker
81+
6682Prybar uses Docker to make it easy to get started with development.
6783First, you must [install Docker](https://docs.docker.com/install/).
6884Then, run:
build-prybar.nix+4−5
@@ -1,10 +1,10 @@
11{ language, buildInputs ? [ ], binaries ? [ ], setFlags ? false
22, pkgName ? language }:
33
4−{ lib, buildGo117Module, fetchFromGitHub, bash, expect, pkg-config, runCommand, git
4+{ lib, buildGoModule, fetchFromGitHub, bash, expect, pkg-config, runCommand, git
55, python3, copyPathToStore, rev, makeWrapper }:
66
7−buildGo117Module {
7+buildGoModule {
88 pname = "prybar-${language}";
99 version = rev;
1010
@@ -54,10 +54,9 @@ buildGo117Module {
5454 # is running in.
5555 export HOME=$(echo pwd)
5656
57− patchShebangs run_no_pty ./tests/${language}/*.exp
58−
5957 # Currently the go tests won't work in nix because of something w/ nix's sandboxing.
60− DISABLE_GO_TESTS=1 "${bash}/bin/bash" "./run_tests_language" "${language}" "${expect}/bin"
58+
59+ DISABLE_GO_TESTS=1 "${bash}/bin/bash" "./run_tests_language" "${language}"
6160
6261 runHook postCheck
6362 '';
flake.lock+8−8
@@ -2,11 +2,11 @@
22 "nodes": {
33 "flake-utils": {
44 "locked": {
5− "lastModified": 1623875721,
6− "narHash": "sha256-A8BU7bjS5GirpAUv4QA+QnJ4CceLHkcXdRp4xITDB0s=",
5+ "lastModified": 1667395993,
6+ "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
77 "owner": "numtide",
88 "repo": "flake-utils",
9− "rev": "f7e004a55b120c02ecb6219596820fcd32ca8772",
9+ "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
1010 "type": "github"
1111 },
1212 "original": {
@@ -17,16 +17,16 @@
1717 },
1818 "nixpkgs": {
1919 "locked": {
20− "lastModified": 1642492175,
21− "narHash": "sha256-lo5hxiY8U4eREChAR7JD94zns92hQqmp3wg3qTFolPA=",
22− "owner": "nixos",
20+ "lastModified": 1670276674,
21+ "narHash": "sha256-FqZ7b2RpoHQ/jlG6JPcCNmG/DoUPCIvyaropUDFhF3Q=",
22+ "owner": "NixOS",
2323 "repo": "nixpkgs",
24− "rev": "9789ed45b759c8f770bcba4b06c1a1c5ec386664",
24+ "rev": "52e3e80afff4b16ccb7c52e9f0f5220552f03d04",
2525 "type": "github"
2626 },
2727 "original": {
2828 "owner": "nixos",
29− "ref": "nixpkgs-unstable",
29+ "ref": "nixos-22.11",
3030 "repo": "nixpkgs",
3131 "type": "github"
3232 }
flake.nix+71−8
@@ -2,11 +2,21 @@
22 description = "A universal interpreter front-end";
33
44 inputs = {
5− nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
5+ nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11";
66 flake-utils.url = "github:numtide/flake-utils";
77 };
88
99 outputs = { self, nixpkgs, flake-utils }:
10+ {
11+ overlays.default = final: prev: {
12+ prybar = prev.lib.recurseIntoAttrs {
13+ inherit (self.packages.${prev.system})
14+ prybar-R prybar-clojure prybar-elisp prybar-julia prybar-lua prybar-nodejs
15+ prybar-ocaml prybar-python2 prybar-python3 prybar-python310 prybar-ruby
16+ prybar-scala prybar-sqlite prybar-tcl;
17+ };
18+ };
19+ } //
1020 flake-utils.lib.eachDefaultSystem (system:
1121 let
1222 pkgs = nixpkgs.legacyPackages.${system};
@@ -23,6 +33,19 @@
2333
2434 clojureWithCP =
2535 import ./languages/clojure/wrappedClojure.nix { inherit pkgs; };
36+
37+ python310Full = pkgs.python310.override {
38+ self = python310Full;
39+ pythonAttr = "python310Full";
40+ bluezSupport = true;
41+ x11Support = true;
42+ };
43+
44+ ocaml = pkgs.ocaml-ng.ocamlPackages_4_12.ocaml;
45+ opam = pkgs.opam;
46+ findlib = pkgs.ocaml-ng.ocamlPackages_4_12.findlib;
47+ topkg = pkgs.ocaml-ng.ocamlPackages_4_12.topkg;
48+ reason = pkgs.ocaml-ng.ocamlPackages_4_12.reason;
2649
2750 in {
2851 packages = {
@@ -35,7 +58,7 @@
3558
3659 prybar-nodejs = buildPrybar {
3760 language = "nodejs";
38− binaries = [ pkgs.nodejs-12_x ];
61+ binaries = [ pkgs.nodejs-16_x ];
3962 };
4063
4164 prybar-python2 = buildPrybar {
@@ -45,7 +68,12 @@
4568
4669 prybar-python3 = buildPrybar {
4770 language = "python3";
48− buildInputs = [ pkgs.python38Full ];
71+ buildInputs = [ pkgs.libxcrypt pkgs.python38Full ];
72+ };
73+
74+ prybar-python310 = buildPrybar {
75+ language = "python310";
76+ buildInputs = [ pkgs.libxcrypt python310Full ];
4977 };
5078
5179 prybar-lua = buildPrybar {
@@ -66,11 +94,11 @@
6694 # This has to be in the build inputs so it set-ups the library paths before the check phase
6795 # It will not be copied over to the final package.
6896 buildInputs = [
69− pkgs.opam
70− pkgs.ocaml
71− pkgs.ocamlPackages.findlib
72− pkgs.ocamlPackages.topkg
73− pkgs.ocamlPackages.reason
97+ opam
98+ ocaml
99+ findlib
100+ topkg
101+ reason
74102 ];
75103 };
76104
@@ -105,6 +133,41 @@
105133
106134 };
107135
136+
137+ devShells.default = pkgs.mkShell {
138+ nativeBuildInputs = [
139+ pkgs.pkg-config
140+ ];
141+ buildInputs = [
142+ pkgs.libxcrypt
143+ pkgs.R
144+ pkgs.nodejs-16_x
145+ pkgs.python2
146+ pkgs.python38Full
147+ pkgs.python310Full
148+ pkgs.lua5_1
149+ pkgs.readline
150+ clojureWithCP
151+ pkgs.jdk11_headless
152+ opam
153+ ocaml
154+ findlib
155+ topkg
156+ reason
157+ julia
158+ pkgs.zlib
159+ pkgs.ruby
160+ pkgs.sqlite
161+ pkgs.tcl
162+ pkgs.expect
163+ ];
164+ shellHook = ''
165+ export CGO_LDFLAGS_ALLOW="-Wl,--compress-debug-sections=zlib"
166+ export DISABLE_GO_TESTS=1
167+ '';
168+ };
169+
170+
108171 });
109172}
110173
languages/julia/main.go+1−1
@@ -3,7 +3,7 @@ package main
33// USING_CGO
44
55/*
6−#cgo CFLAGS: -I/usr/include/julia
6+#cgo pkg-config: julia
77#cgo LDFLAGS: -ljulia
88#include "pry.h"
99*/
languages/python310/.gitignorenew file+3
@@ -0,0 +1,3 @@
1+main.go
2+pry_python3.c
3+pry_python3.h
languages/python310/compilenew file+9
@@ -0,0 +1,9 @@
1+#!/usr/bin/env bash
2+
3+COMPILE_DIR="$(dirname "$0")"
4+
5+cp $COMPILE_DIR/../python3/* $COMPILE_DIR/
6+
7+sed -i "s/python-3.8-embed/python-3.10-embed/g" $COMPILE_DIR/main.go
8+
9+bash $COMPILE_DIR/../../scripts/inject.sh python310
run_tests+3−2
@@ -9,7 +9,8 @@ for t in ${tests}; do
99 if [[ $t != *.exp ]]; then
1010 echo "$t:"
1111
12− if [[ $t == 'nodejs' ]]; then
12+ if [[ $t == 'nodejs' && $DISABLE_GO_TESTS != 1 ]]; then
13+
1314 go test ./tests/nodejs
1415 fi
1516
@@ -20,7 +21,7 @@ for t in ${tests}; do
2021
2122 echo -n "... $name"
2223
23− test_out=$(timeout 15 "./tests/$t" 2>&1)
24+ test_out=$(timeout 15 expect "./tests/$t" 2>&1)
2425 if [[ $? != 0 ]]; then
2526 echo -e "\n========== \"$t\" failed =========="
2627 echo $test_out
run_tests_language+2−3
@@ -4,7 +4,6 @@ stty cols 80
44stty rows 20
55
66language=$1
7−expect_path=$2
87tests=$(find "./tests/${language}" ! -name '*.go' -printf '%P\n')
98
109for t in ${tests}; do
@@ -16,9 +15,9 @@ for t in ${tests}; do
1615 name=$(echo -n $t | sed -s 's/.*\/\(.*\).exp/\1/' | sed -s 's/_/ /g')
1716
1817 echo -n "... ${language} $name"
18+
1919
20− sed -i "s;#!/usr/bin/expect;#!${expect_path}/expect;" "./tests/${language}/$t"
21− test_out=$(timeout 15 "./tests/${language}/$t" 2>&1)
20+ test_out=$(timeout 15 expect -f "./tests/${language}/$t" 2>&1)
2221 if [[ $? != 0 ]]; then
2322 echo -e "\n========== \"$t\" failed =========="
2423 echo "$test_out"
scripts/docker-install.sh+14
@@ -41,13 +41,19 @@ rlwrap
4141
4242"
4343
44+
4445export DEBIAN_FRONTEND=noninteractive
4546apt-get update
47+apt install software-properties-common -y
4648apt-get install -y curl
4749curl -sL https://deb.nodesource.com/setup_14.x | bash -
4850apt-get install -y $(grep -v "^#" <<< "$packages")
4951rm -rf /var/lib/apt/lists/*
5052
53+printf "\n" | add-apt-repository ppa:deadsnakes/ppa
54+apt install python3.10 -y
55+apt install python3.10-dev -y
56+
5157go_version=1.16.5
5258wget "https://dl.google.com/go/go${go_version}.linux-amd64.tar.gz"
5359tar -xvf "go${go_version}.linux-amd64.tar.gz"
@@ -70,6 +76,14 @@ cp -R julia-*/lib/* /usr/lib/
7076cp -R julia-*/share/* /usr/share/
7177rm -rf julia-*
7278
79+cat > /usr/lib/x86_64-linux-gnu/pkgconfig/julia.pc <<- EOM
80+ Name: julia
81+ Cflags: -I/usr/include/julia
82+ Version: 1.5.4
83+ Description: it's julia
84+ Libs: -L/usr/lib -ljulia
85+EOM
86+
7387wget -nv https://downloads.lightbend.com/scala/2.13.1/scala-2.13.1.tgz
7488tar -xf *.tgz
7589cp -R scala-*/bin/* /usr/local/bin/
tests/nodejs/err.exp+1−1
@@ -5,6 +5,6 @@ spawn ./prybar-nodejs -i -q
55match_max 100000
66expect -exact "\[1G\[0J--> \[5G"
77send -- "x\r"
8−expect -e "\[31mReferenceError: x is not defined\[0m\r"
8+expect -e "ReferenceError: x is not defined"
99send -- ""
1010expect eof
tests/nodejs/prompt_no_tty.exp+1−1
@@ -1,7 +1,7 @@
11#!/usr/bin/expect -f
22set timeout -1
33set stty_init raw
4−spawn ./run_no_pty ./prybar-nodejs -q -i
4+spawn bash ./run_no_pty ./prybar-nodejs -q -i
55match_max 100000
66expect -exact "--> "
77