Compare commits

...

5 commits

Author SHA1 Message Date
Gabriel Francischini C. Pereira
7d9b4a81dd
Merge fc33860983 into 1d55a41a2d 2025-03-18 07:25:35 +00:00
Omar Brikaa
1d55a41a2d
Explicitly provide env vars instead of inheriting them from parent (#703) 2025-02-08 20:46:46 +02:00
Omar Brikaa
6ef0cdf7b4
Provide HOME in sandbox (#702) 2025-02-08 15:10:50 +02:00
Thomas Hobson
fc33860983
Merge branch 'master' into add-hy-1.0a4 2022-10-15 22:14:07 +13:00
Gabriel F
0a5a5cc2f8 added hy 1.0a4 2022-06-16 16:31:21 -03:00
8 changed files with 54 additions and 14 deletions

View file

@ -156,7 +156,11 @@ class Job {
'-s', '-s',
'-c', '-c',
'/box/submission', '/box/submission',
'-e', '-E',
'HOME=/tmp',
...this.runtime.env_vars.flat_map(v => ['-E', v]),
'-E',
`PISTON_LANGUAGE=${this.runtime.language}`,
`--dir=${this.runtime.pkgdir}`, `--dir=${this.runtime.pkgdir}`,
`--dir=/etc:noexec`, `--dir=/etc:noexec`,
`--processes=${this.runtime.max_process_count}`, `--processes=${this.runtime.max_process_count}`,
@ -175,10 +179,6 @@ class Job {
...args, ...args,
], ],
{ {
env: {
...this.runtime.env_vars,
PISTON_LANGUAGE: this.runtime.language,
},
stdio: 'pipe', stdio: 'pipe',
} }
); );

View file

@ -178,15 +178,7 @@ class Runtime {
const env_file = path.join(this.pkgdir, '.env'); const env_file = path.join(this.pkgdir, '.env');
const env_content = fss.read_file_sync(env_file).toString(); const env_content = fss.read_file_sync(env_file).toString();
this._env_vars = {}; this._env_vars = env_content.trim().split('\n');
env_content
.trim()
.split('\n')
.map(line => line.split('=', 2))
.forEach(([key, val]) => {
this._env_vars[key.trim()] = val.trim();
});
} }
return this._env_vars; return this._env_vars;

View file

@ -0,0 +1,22 @@
#!/bin/bash
PREFIX=$(realpath $(dirname $0))
mkdir -p build
cd build
curl "https://www.python.org/ftp/python/3.10.0/Python-3.10.0.tgz" -o python.tar.gz
tar xzf python.tar.gz --strip-components=1
rm python.tar.gz
./configure --prefix "$PREFIX" --with-ensurepip=install
make -j$(nproc)
make install -j$(nproc)
cd ..
rm -rf build
bin/pip3 install numpy scipy pandas pycrypto whoosh bcrypt passlib sympy
bin/pip3 install --pre hy==1.0a4 hyrule==0.1 toolz multipledispatch funcy funcy_chain pyrsistent

View file

@ -0,0 +1 @@
export PATH=$PWD/bin:$PATH

View file

@ -0,0 +1,5 @@
{
"language": "hy",
"version": "1.0a4",
"aliases": ["hy", "hy1.0", "hy1.0a4"]
}

3
packages/hy/1.0a4/run Normal file
View file

@ -0,0 +1,3 @@
#!/bin/bash
hy "$@"

16
packages/hy/1.0a4/test.hy Normal file
View file

@ -0,0 +1,16 @@
(print (cut "abcdef" 1 4))
(defn test [a b [c None] [d "x"] #* e]
[a b c d e])
(print (test 1 2)) ; => [1, 2, None, 'x', ()]
(print (test 1 2 3 4 5 6 7)) ; => [1, 2, 3, 4, (5, 6, 7)]
(import math)
(print (math.sqrt 2))
(import hyrule [inc])
(require hyrule [assoc])
(print (list (map inc [1 2 3])))
(setv d {})
(assoc d "a" 1 "b" 2)
(print d)

View file

@ -398,6 +398,7 @@ Errors may return status codes as follows:
`groovy`, `groovy`,
`haskell`, `haskell`,
`husk`, `husk`,
`hy`,
`iverilog`, `iverilog`,
`japt`, `japt`,
`java`, `java`,