Skip to content
Snippets Groups Projects
Commit 8ac62e7e authored by Henke Adolfsson's avatar Henke Adolfsson
Browse files

Merge branch 'master' of git.lysator.liu.se:catears/kattis-command

parents 3d3053a0 4000fa36
No related branches found
No related tags found
No related merge requests found
Pipeline #
......@@ -4,3 +4,4 @@ venv/*
__pycache__/*
dist/*
__pycache__/
MANIFEST
\ No newline at end of file
......@@ -89,13 +89,20 @@ def CompileCpp(bus, problemname):
try:
os.system(compile_command)
except Exception as e:
bus.call('kattcmd:compile:cpp-compile-failed', compile_command)
os.chdir(old_cwd)
return
if os.path.exists(output_binary):
os.chdir(old_cwd)
bus.call('kattcmd:compile:cpp-compiled', output_binary)
return output_binary
except:
else:
os.chdir(old_cwd)
bus.call('kattcmd:compile:cpp-compile-failed', compile_command)
def FindCppCompileCommand(bus):
'''Returns either the user-set compile command or the default one.'''
default_compile = 'g++ -std=c++14 -O2 -pedantic -Wall FILES -o BINARY'
......
......@@ -94,7 +94,7 @@ def CLI(bus, parent):
When running the program it will use a timeout of ten seconds.
'''
bus.listen('kattcmd:test:no-tests', OnNoTest)
bus.listen('kattcmd:test:no-tests', OnNoTestsFound)
bus.listen('kattcmd:compile:python-compiled', OnPythonCompiled)
bus.listen('kattcmd:compile:cpp-compiled', OnCppCompiled)
bus.listen('kattcmd:compile:cpp-compile-failed', OnCppFailed)
......@@ -109,18 +109,18 @@ def CLI(bus, parent):
return
# TODO: below should use kattcmd:latest
language, _ = bus.call('kattcmd:latest', bus, name)
language, items = bus.call('kattcmd:latest', bus, name)
topic_mapping = {
'python': 'kattcmd:run:python',
'cpp': 'kattcmd:run:cpp'
'python': ('kattcmd:compile:python', 'kattcmd:run:python'),
'cpp': ('kattcmd:compile:cpp', 'kattcmd:run:cpp')
}
if not language in topic_mapping:
click.secho('Cannot run for language: {}'.format(language), fg='red')
return
topic = topic_mapping[language]
items = [os.path.join(directory, item) for item in items]
compile_topic, run_topic = topic_mapping[language]
args = [name]
# Find all test files
tests = list(sorted(bus.call('kattcmd:test', bus, name)))
......@@ -128,7 +128,10 @@ def CLI(bus, parent):
answers = [answer for _, answer in tests]
# Run against all text files
outputs = bus.call(topic, bus, inputs, *args)
compiled = bus.call(compile_topic, bus, *args)
if not compiled:
return
outputs = bus.call(run_topic, bus, inputs, *args)
first = True
# Output the diffs between the text files
......
#!/usr/bin/env python
# How to update:
# 0. source the virtualenv
# 1. Create a new tag on gitlab and find the download url (archive.tar.gz) for that tag
# 2. Update the version in setup()
# 3. run `python setup.py sdist` and test with tar.gz in dist folder
# 4. run `twine upload dist/YOUR_NEWLY_CREATED_ARCHIVE.tar.gz`
from distutils.core import setup
setup(
name='kattcmd',
packages=['kattcmd', 'kattcmd.commands'],
version='0.0.1',
version='0.0.4',
description='Kattis solution management CLI written in python',
author='Henrik Adolfsson',
author_email='anting004@gmail.com',
url='https://git.lysator.liu.se/catears/kattis-command',
download_url='httsp://git.lysator.liu.se/catears/kattis-command/master/archive.tar.gz',
download_url='https://git.lysator.liu.se/catears/kattis-command/repository/0.0.2/archive.tar.gz',
keywords=['kattis', 'cli', 'competitive programming'],
install_requires=['requests', 'click', 'pydash'],
python_requires='>=3.4',
scripts=['bin/kattcmd'],
package_dir={
'kattcmd.commands': 'kattcmd/commands'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment