Skip to content

Commit

Permalink
restructure project entry point for rpython
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowone committed Jan 10, 2016
1 parent bf3f1b4 commit b94e4a2
Show file tree
Hide file tree
Showing 10 changed files with 84 additions and 46 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ install:
# command to run tests
script:
- "py.test tests/"
- "cd snippets && AHEUI=../aheui/aheui.py ./test.sh standard"
- "cd snippets && AHEUI=../rpaheui.py ./test.sh standard"
sudo: false
17 changes: 11 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,30 @@ RPYTHON?=../pypy/rpython/bin/rpython
RPYTHONFLAGS?=--opt=jit


all: aheui-c
all: aheui-c aheui-py

version:
echo "VERSION = '`git describe --tags`'" > aheui/version.py

aheui-py:
cp rpaheui.py bin/aheui-py
cp rpaheui.py bin/aheui

aheui-c: version
cd aheui && ../$(RPYTHON) $(RPYTHONFLAGS) aheui.py
$(RPYTHON) $(RPYTHONFLAGS) rpaheui.py

clean:
rm aheui-c
rm rpaheui-c

install: aheui-c
cp aheui/aheui-c /usr/local/bin/aheui
cp rpaheui-c /usr/local/bin/rpaheui
ln -s /usr/local/bin/rpaheui /usr/local/bin/aheui

test:
if [ -e snippets ]; then cd snippets && git pull; else git clone https://github.com/aheui/snippets; fi
cd snippets && AHEUI="../aheui/aheui-c" bash test.sh
cd snippets && AHEUI="../rpaheui-c" bash test.sh

testpy:
py.test
if [ -e snippets ]; then cd snippets && git pull; else git clone https://github.com/aheui/snippets; fi
cd snippets && AHEUI=../aheui/aheui.py bash test.sh
cd snippets && AHEUI=../rpaheui.py bash test.sh
6 changes: 0 additions & 6 deletions aheui/aheui-py

This file was deleted.

36 changes: 8 additions & 28 deletions aheui/aheui.py
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
#!/usr/bin/env python
# coding: utf-8

from __future__ import absolute_import

import os

try:
from aheui.const import *
from aheui._compat import *
from aheui import _argparse
from aheui import compile
from aheui.int import smallint as bigint
except ImportError:
from const import *
from _compat import *
from _compat import _unicode
import _argparse
import compile
from int import smallint as bigint # import `bigint` to enable bigint
from aheui.const import *
from aheui._compat import *
from aheui._compat import _unicode
from aheui import _argparse
from aheui import compile
from aheui.int import smallint as bigint # import `bigint` to enable bigint


def get_location(pc, stackok, is_queue, program):
Expand Down Expand Up @@ -527,18 +522,3 @@ def entry_point(argv):
else:
assert False
return exitcode


def jitpolicy(driver):
from rpython.jit.codewriter.policy import JitPolicy
return JitPolicy()


def target(*args):
return entry_point, None


if __name__ == '__main__':
"""Python compatibility."""
import sys
sys.exit(entry_point(sys.argv))
2 changes: 1 addition & 1 deletion aheui/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = '1.2.0'
VERSION = '1.2.1'
6 changes: 3 additions & 3 deletions aheui/ahsembler.py → ahsembler.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#!/usr/bin/env python

import aheui


def entry_point(argv):
return aheui.entry_point(argv + ['--target=asm', '--output=-'])
from aheui.aheui import entry_point
return entry_point(argv + ['--target=asm', '--output=-'])


def target(*args):
return entry_point, None


if __name__ == '__main__':
import sys
entry_point(sys.argv)
19 changes: 19 additions & 0 deletions bin/aheui
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env python
# coding: utf-8


def jitpolicy(driver):
from rpython.jit.codewriter.policy import JitPolicy
return JitPolicy()


def target(*args):
from aheui.aheui import entry_point
return entry_point, None


if __name__ == '__main__':
"""Python compatibility."""
import sys
from aheui.aheui import entry_point
sys.exit(entry_point(sys.argv))
19 changes: 19 additions & 0 deletions bin/aheui-py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env python
# coding: utf-8


def jitpolicy(driver):
from rpython.jit.codewriter.policy import JitPolicy
return JitPolicy()


def target(*args):
from aheui.aheui import entry_point
return entry_point, None


if __name__ == '__main__':
"""Python compatibility."""
import sys
from aheui.aheui import entry_point
sys.exit(entry_point(sys.argv))
19 changes: 19 additions & 0 deletions rpaheui.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env python
# coding: utf-8


def jitpolicy(driver):
from rpython.jit.codewriter.policy import JitPolicy
return JitPolicy()


def target(*args):
from aheui.aheui import entry_point
return entry_point, None


if __name__ == '__main__':
"""Python compatibility."""
import sys
from aheui.aheui import entry_point
sys.exit(entry_point(sys.argv))
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def get_readme():
url='https://github.com/aheui/rpaheui',
packages=(
'aheui',
'aheui/int',
),
package_data={
'aheui': ['version.py']
Expand All @@ -36,7 +37,8 @@ def get_readme():
'flake8', 'tox', 'pytest',
],
scripts=[
'aheui/aheui-py'
'bin/aheui-py',
'bin/aheui',
],
classifiers=[
'Intended Audience :: Developers',
Expand Down

0 comments on commit b94e4a2

Please sign in to comment.