Skip to content

Commit bad9a6e

Browse files
authored
Install libkarel from PyPI (#9)
This change uses the PyPI wheel instead of just copying the .py file from GitHub. #minor
1 parent 527fa3f commit bad9a6e

3 files changed

Lines changed: 22 additions & 6 deletions

File tree

Dockerfile.rootfs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ RUN rm packages-microsoft-prod.deb
1616
RUN apt-get update -y && \
1717
apt-get install --no-install-recommends -y \
1818
clang-10 \
19-
dotnet-sdk-3.1 \
19+
dotnet-sdk-3.1=3.1.401-1 \
2020
fp-compiler-3.0.4 \
2121
fp-units-fcl-3.0.4 \
2222
g++ \

args.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ bool Args::SetCompileFlags(std::string_view root,
453453
return false;
454454
program_args_holder = {
455455
"/usr/share/dotnet/dotnet",
456-
"/usr/share/dotnet/sdk/3.1.301/Roslyn/bincore/csc.dll",
456+
"/usr/share/dotnet/sdk/3.1.401/Roslyn/bincore/csc.dll",
457457
"-noconfig",
458458
"@/usr/share/dotnet/Release.rsp",
459459
StringPrintf("-out:%s.dll",

tools/mkroot

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import tarfile
1515
import tempfile
1616
import textwrap
1717
import urllib.request
18+
import zipfile
1819
from typing import Any, Dict, List, Optional, Sequence, Set, Union
1920

2021
import apt
@@ -600,7 +601,7 @@ def _main() -> None:
600601
root.copyfromhost(filename)
601602

602603
with RemoteFile(
603-
'https://raw.githubusercontent.com/omegaup/libkarel/master/libkarel.py',
604+
'https://raw.githubusercontent.com/omegaup/libkarel/v0.0.99/libkarel.py',
604605
'9b67427877bb8ba5bbf3bbde9dcf828c81d3f2cd') as remote_file:
605606
root.install('/usr/lib/python2.7/libkarel.py', remote_file.path)
606607

@@ -615,9 +616,24 @@ def _main() -> None:
615616
root.copyfromhost(filename)
616617

617618
with RemoteFile(
618-
'https://raw.githubusercontent.com/omegaup/libkarel/master/libkarel.py',
619-
'9b67427877bb8ba5bbf3bbde9dcf828c81d3f2cd') as remote_file:
620-
root.install('/usr/lib/python3.8/libkarel.py', remote_file.path)
619+
'https://files.pythonhosted.org/packages/97/20/a73731474363a3998d7b9097632be23ab17c4ad551aea4f1234fd964e524/libkarel-1.0.2-py3-none-any.whl',
620+
'1585263c50bf3956350fd617258b48ca05013776') as remote_file:
621+
with zipfile.ZipFile(remote_file.path) as z:
622+
z.extractall(os.path.join(PYTHON3_ROOT, 'dist-packages'))
623+
logging.info('Precompiling libkarel.')
624+
subprocess.check_call([
625+
'/usr/bin/python3',
626+
'-m',
627+
'py_compile',
628+
os.path.join(PYTHON3_ROOT, 'dist-packages/libkarel/__init__.py'),
629+
os.path.join(PYTHON3_ROOT, 'dist-packages/libkarel/libkarel.py'),
630+
os.path.join(PYTHON3_ROOT, 'dist-packages/libkarel/kareltest.py'),
631+
])
632+
root.copyfromhost(os.path.join(PYTHON3_ROOT, 'dist-packages/libkarel'))
633+
root.copyfromhost(
634+
os.path.join(PYTHON3_ROOT,
635+
'dist-packages/libkarel-1.0.2.dist-info'))
636+
logging.info('Done.')
621637

622638
with Chroot(
623639
os.path.join(args.target, 'root-ruby'), RUBY_ROOT,

0 commit comments

Comments
 (0)