on master help sign in
README.md+17−1
since splitsnapshots
unifiedsplit
@@ -50,19 +50,35 @@ written in the host language which starts a Prybar-compatible REPL.
50| SQLite | ✔ | ✔ | ✔ | ✔ | ✗ | ✔ |
50| SQLite | ✔ | ✔ | ✔ | ✔ | ✗ | ✔ |
51| Tcl | ✔ | ✔ | ✔ | ✗ | ✗ | - |
51| Tcl | ✔ | ✔ | ✔ | ✗ | ✗ | - |
52
52
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+
53## Build and run
65## Build and run
54
66
55 % make help
67 % make help
56 usage:
68 usage:
57 make all Build all Prybar binaries
69 make all Build all Prybar binaries
58 make prybar-LANG Build the Prybar binary for LANG
70 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)
60 make image Build a Docker image with Prybar for distribution
74 make image Build a Docker image with Prybar for distribution
61 make test Run integration tests
75 make test Run integration tests
62 make test-image Test Docker image for distribution
76 make test-image Test Docker image for distribution
63 make clean Remove build artifacts
77 make clean Remove build artifacts
64 make help Show this message
78 make help Show this message
65
79
80+## You can also use Docker
81+
66Prybar uses Docker to make it easy to get started with development.
82Prybar uses Docker to make it easy to get started with development.
67First, you must [install Docker](https://docs.docker.com/install/).
83First, you must [install Docker](https://docs.docker.com/install/).
68Then, run:
84Then, run:
build-prybar.nix+4−5
@@ -1,10 +1,10 @@
1{ language, buildInputs ? [ ], binaries ? [ ], setFlags ? false
1{ language, buildInputs ? [ ], binaries ? [ ], setFlags ? false
2, pkgName ? language }:
2, pkgName ? language }:
3
3
4−{ lib, buildGo117Module, fetchFromGitHub, bash, expect, pkg-config, runCommand, git
4+{ lib, buildGoModule, fetchFromGitHub, bash, expect, pkg-config, runCommand, git
5, python3, copyPathToStore, rev, makeWrapper }:
5, python3, copyPathToStore, rev, makeWrapper }:
6
6
7−buildGo117Module {
7+buildGoModule {
8 pname = "prybar-${language}";
8 pname = "prybar-${language}";
9 version = rev;
9 version = rev;
10
10
@@ -54,10 +54,9 @@ buildGo117Module {
54 # is running in.
54 # is running in.
55 export HOME=$(echo pwd)
55 export HOME=$(echo pwd)
56
56
57− patchShebangs run_no_pty ./tests/${language}/*.exp
58−
59 # Currently the go tests won't work in nix because of something w/ nix's sandboxing.
57 # Currently the go tests won't work in nix because of something w/ nix's sandboxing.
58+
60− DISABLE_GO_TESTS=1 "${bash}/bin/bash" "./run_tests_language" "${language}" "${expect}/bin"
59+ DISABLE_GO_TESTS=1 "${bash}/bin/bash" "./run_tests_language" "${language}"
61
60
62 runHook postCheck
61 runHook postCheck
63 '';
62 '';
flake.lock+8−8
@@ -2,11 +2,11 @@
2 "nodes": {
2 "nodes": {
3 "flake-utils": {
3 "flake-utils": {
4 "locked": {
4 "locked": {
5− "lastModified": 1623875721,
5+ "lastModified": 1667395993,
6− "narHash": "sha256-A8BU7bjS5GirpAUv4QA+QnJ4CceLHkcXdRp4xITDB0s=",
6+ "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
7 "owner": "numtide",
7 "owner": "numtide",
8 "repo": "flake-utils",
8 "repo": "flake-utils",
9− "rev": "f7e004a55b120c02ecb6219596820fcd32ca8772",
9+ "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
10 "type": "github"
10 "type": "github"
11 },
11 },
12 "original": {
12 "original": {
@@ -17,16 +17,16 @@
17 },
17 },
18 "nixpkgs": {
18 "nixpkgs": {
19 "locked": {
19 "locked": {
20− "lastModified": 1642492175,
20+ "lastModified": 1670276674,
21− "narHash": "sha256-lo5hxiY8U4eREChAR7JD94zns92hQqmp3wg3qTFolPA=",
21+ "narHash": "sha256-FqZ7b2RpoHQ/jlG6JPcCNmG/DoUPCIvyaropUDFhF3Q=",
22− "owner": "nixos",
22+ "owner": "NixOS",
23 "repo": "nixpkgs",
23 "repo": "nixpkgs",
24− "rev": "9789ed45b759c8f770bcba4b06c1a1c5ec386664",
24+ "rev": "52e3e80afff4b16ccb7c52e9f0f5220552f03d04",
25 "type": "github"
25 "type": "github"
26 },
26 },
27 "original": {
27 "original": {
28 "owner": "nixos",
28 "owner": "nixos",
29− "ref": "nixpkgs-unstable",
29+ "ref": "nixos-22.11",
30 "repo": "nixpkgs",
30 "repo": "nixpkgs",
31 "type": "github"
31 "type": "github"
32 }
32 }
flake.nix+71−8
@@ -2,11 +2,21 @@
2 description = "A universal interpreter front-end";
2 description = "A universal interpreter front-end";
3
3
4 inputs = {
4 inputs = {
5− nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
5+ nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11";
6 flake-utils.url = "github:numtide/flake-utils";
6 flake-utils.url = "github:numtide/flake-utils";
7 };
7 };
8
8
9 outputs = { self, nixpkgs, flake-utils }:
9 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+ } //
10 flake-utils.lib.eachDefaultSystem (system:
20 flake-utils.lib.eachDefaultSystem (system:
11 let
21 let
12 pkgs = nixpkgs.legacyPackages.${system};
22 pkgs = nixpkgs.legacyPackages.${system};
@@ -23,6 +33,19 @@
23
33
24 clojureWithCP =
34 clojureWithCP =
25 import ./languages/clojure/wrappedClojure.nix { inherit pkgs; };
35 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;
26
49
27 in {
50 in {
28 packages = {
51 packages = {
@@ -35,7 +58,7 @@
35
58
36 prybar-nodejs = buildPrybar {
59 prybar-nodejs = buildPrybar {
37 language = "nodejs";
60 language = "nodejs";
38− binaries = [ pkgs.nodejs-12_x ];
61+ binaries = [ pkgs.nodejs-16_x ];
39 };
62 };
40
63
41 prybar-python2 = buildPrybar {
64 prybar-python2 = buildPrybar {
@@ -45,7 +68,12 @@
45
68
46 prybar-python3 = buildPrybar {
69 prybar-python3 = buildPrybar {
47 language = "python3";
70 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 ];
49 };
77 };
50
78
51 prybar-lua = buildPrybar {
79 prybar-lua = buildPrybar {
@@ -66,11 +94,11 @@
66 # This has to be in the build inputs so it set-ups the library paths before the check phase
94 # This has to be in the build inputs so it set-ups the library paths before the check phase
67 # It will not be copied over to the final package.
95 # It will not be copied over to the final package.
68 buildInputs = [
96 buildInputs = [
69− pkgs.opam
97+ opam
70− pkgs.ocaml
98+ ocaml
71− pkgs.ocamlPackages.findlib
99+ findlib
72− pkgs.ocamlPackages.topkg
100+ topkg
73− pkgs.ocamlPackages.reason
101+ reason
74 ];
102 ];
75 };
103 };
76
104
@@ -105,6 +133,41 @@
105
133
106 };
134 };
107
135
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+
108 });
171 });
109}
172}
110
173
languages/julia/main.go+1−1
@@ -3,7 +3,7 @@ package main
3// USING_CGO
3// USING_CGO
4
4
5/*
5/*
6−#cgo CFLAGS: -I/usr/include/julia
6+#cgo pkg-config: julia
7#cgo LDFLAGS: -ljulia
7#cgo LDFLAGS: -ljulia
8#include "pry.h"
8#include "pry.h"
9*/
9*/
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
9 if [[ $t != *.exp ]]; then
9 if [[ $t != *.exp ]]; then
10 echo "$t:"
10 echo "$t:"
11
11
12− if [[ $t == 'nodejs' ]]; then
12+ if [[ $t == 'nodejs' && $DISABLE_GO_TESTS != 1 ]]; then
13+
13 go test ./tests/nodejs
14 go test ./tests/nodejs
14 fi
15 fi
15
16
@@ -20,7 +21,7 @@ for t in ${tests}; do
20
21
21 echo -n "... $name"
22 echo -n "... $name"
22
23
23− test_out=$(timeout 15 "./tests/$t" 2>&1)
24+ test_out=$(timeout 15 expect "./tests/$t" 2>&1)
24 if [[ $? != 0 ]]; then
25 if [[ $? != 0 ]]; then
25 echo -e "\n========== \"$t\" failed =========="
26 echo -e "\n========== \"$t\" failed =========="
26 echo $test_out
27 echo $test_out
run_tests_language+2−3
@@ -4,7 +4,6 @@ stty cols 80
4stty rows 20
4stty rows 20
5
5
6language=$1
6language=$1
7−expect_path=$2
8tests=$(find "./tests/${language}" ! -name '*.go' -printf '%P\n')
7tests=$(find "./tests/${language}" ! -name '*.go' -printf '%P\n')
9
8
10for t in ${tests}; do
9for t in ${tests}; do
@@ -16,9 +15,9 @@ for t in ${tests}; do
16 name=$(echo -n $t | sed -s 's/.*\/\(.*\).exp/\1/' | sed -s 's/_/ /g')
15 name=$(echo -n $t | sed -s 's/.*\/\(.*\).exp/\1/' | sed -s 's/_/ /g')
17
16
18 echo -n "... ${language} $name"
17 echo -n "... ${language} $name"
18+
19
19
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)
22 if [[ $? != 0 ]]; then
21 if [[ $? != 0 ]]; then
23 echo -e "\n========== \"$t\" failed =========="
22 echo -e "\n========== \"$t\" failed =========="
24 echo "$test_out"
23 echo "$test_out"
scripts/docker-install.sh+14
@@ -41,13 +41,19 @@ rlwrap
41
41
42"
42"
43
43
44+
44export DEBIAN_FRONTEND=noninteractive
45export DEBIAN_FRONTEND=noninteractive
45apt-get update
46apt-get update
47+apt install software-properties-common -y
46apt-get install -y curl
48apt-get install -y curl
47curl -sL https://deb.nodesource.com/setup_14.x | bash -
49curl -sL https://deb.nodesource.com/setup_14.x | bash -
48apt-get install -y $(grep -v "^#" <<< "$packages")
50apt-get install -y $(grep -v "^#" <<< "$packages")
49rm -rf /var/lib/apt/lists/*
51rm -rf /var/lib/apt/lists/*
50
52
53+printf "\n" | add-apt-repository ppa:deadsnakes/ppa
54+apt install python3.10 -y
55+apt install python3.10-dev -y
56+
51go_version=1.16.5
57go_version=1.16.5
52wget "https://dl.google.com/go/go${go_version}.linux-amd64.tar.gz"
58wget "https://dl.google.com/go/go${go_version}.linux-amd64.tar.gz"
53tar -xvf "go${go_version}.linux-amd64.tar.gz"
59tar -xvf "go${go_version}.linux-amd64.tar.gz"
@@ -70,6 +76,14 @@ cp -R julia-*/lib/* /usr/lib/
70cp -R julia-*/share/* /usr/share/
76cp -R julia-*/share/* /usr/share/
71rm -rf julia-*
77rm -rf julia-*
72
78
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+
73wget -nv https://downloads.lightbend.com/scala/2.13.1/scala-2.13.1.tgz
87wget -nv https://downloads.lightbend.com/scala/2.13.1/scala-2.13.1.tgz
74tar -xf *.tgz
88tar -xf *.tgz
75cp -R scala-*/bin/* /usr/local/bin/
89cp -R scala-*/bin/* /usr/local/bin/
tests/nodejs/err.exp+1−1
@@ -5,6 +5,6 @@ spawn ./prybar-nodejs -i -q
5match_max 100000
5match_max 100000
6expect -exact "\[1G\[0J--> \[5G"
6expect -exact "\[1G\[0J--> \[5G"
7send -- "x\r"
7send -- "x\r"
8−expect -e "\[31mReferenceError: x is not defined\[0m\r"
8+expect -e "ReferenceError: x is not defined"
9send -- ""
9send -- ""
10expect eof
10expect eof
tests/nodejs/prompt_no_tty.exp+1−1
@@ -1,7 +1,7 @@
1#!/usr/bin/expect -f
1#!/usr/bin/expect -f
2set timeout -1
2set timeout -1
3set stty_init raw
3set stty_init raw
4−spawn ./run_no_pty ./prybar-nodejs -q -i
4+spawn bash ./run_no_pty ./prybar-nodejs -q -i
5match_max 100000
5match_max 100000
6expect -exact "--> "
6expect -exact "--> "
7
7