on master help sign in
10 files changed+105−31
since splitsnapshots
unifiedsplit
README.md+17−1 build-prybar.nix+4−5 flake.lock+8−8 flake.nix+60−9 languages/julia/main.go+1−1 run_tests+3−2 run_tests_language+2−3 scripts/docker-install.sh+8 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+60−9
@@ -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};
@@ -31,6 +41,12 @@
3141 x11Support = true;
3242 };
3343
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;
49+
3450 in {
3551 packages = {
3652 prybar-R = buildPrybar {
@@ -42,7 +58,7 @@
4258
4359 prybar-nodejs = buildPrybar {
4460 language = "nodejs";
45− binaries = [ pkgs.nodejs-12_x ];
61+ binaries = [ pkgs.nodejs-16_x ];
4662 };
4763
4864 prybar-python2 = buildPrybar {
@@ -52,12 +68,12 @@
5268
5369 prybar-python3 = buildPrybar {
5470 language = "python3";
55− buildInputs = [ pkgs.python38Full ];
71+ buildInputs = [ pkgs.libxcrypt pkgs.python38Full ];
5672 };
5773
5874 prybar-python310 = buildPrybar {
5975 language = "python310";
60− buildInputs = [ python310Full ];
76+ buildInputs = [ pkgs.libxcrypt python310Full ];
6177 };
6278
6379 prybar-lua = buildPrybar {
@@ -78,11 +94,11 @@
7894 # This has to be in the build inputs so it set-ups the library paths before the check phase
7995 # It will not be copied over to the final package.
8096 buildInputs = [
81− pkgs.opam
82− pkgs.ocaml
83− pkgs.ocamlPackages.findlib
84− pkgs.ocamlPackages.topkg
85− pkgs.ocamlPackages.reason
97+ opam
98+ ocaml
99+ findlib
100+ topkg
101+ reason
86102 ];
87103 };
88104
@@ -117,6 +133,41 @@
117133
118134 };
119135
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+
120171 });
121172}
122173
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*/
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+8
@@ -76,6 +76,14 @@ cp -R julia-*/lib/* /usr/lib/
7676cp -R julia-*/share/* /usr/share/
7777rm -rf julia-*
7878
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+
7987wget -nv https://downloads.lightbend.com/scala/2.13.1/scala-2.13.1.tgz
8088tar -xf *.tgz
8189cp -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