Skip to content

Commit

Permalink
Fix problem with conda-build that entrypoint scripts are not installed
Browse files Browse the repository at this point in the history
  • Loading branch information
sklam committed Apr 16, 2015
1 parent f28476d commit 0e4937f
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 50 deletions.
50 changes: 2 additions & 48 deletions bin/numba
Original file line number Diff line number Diff line change
Expand Up @@ -2,53 +2,7 @@
# -*- coding: UTF-8 -*-
from __future__ import print_function, division, absolute_import

import sys
import argparse
import os
import subprocess


def make_parser():
parser = argparse.ArgumentParser()
parser.add_argument('--annotate', help='Annotate source',
action='store_true')
parser.add_argument('--dump-llvm', action="store_true",
help='Print generated llvm assembly')
parser.add_argument('--dump-optimized', action='store_true',
help='Dump the optimized llvm assembly')
parser.add_argument('--dump-assembly', action='store_true',
help='Dump the LLVM generated assembly')
parser.add_argument('--dump-cfg', action="store_true",
help='[Deprecated] Dump the control flow graph')
parser.add_argument('--dump-ast', action="store_true",
help='[Deprecated] Dump the AST')
parser.add_argument('--annotate-html', nargs=1,
help='Output source annotation as html')
parser.add_argument('filename', help='Python source filename')
return parser
from numba.numba_entry import main

if __name__ == "__main__":
parser = make_parser()
args = parser.parse_args()

if args.dump_cfg:
print("CFG dump is removed.")
sys.exit(1)
if args.dump_ast:
print("AST dump is removed. Numba no longer depends on AST.")
sys.exit(1)

os.environ['NUMBA_DUMP_ANNOTATION'] = str(int(args.annotate))
if args.annotate_html is not None:
try:
from jinja2 import Template
except ImportError:
raise ImportError("Please install the 'jinja2' package")
os.environ['NUMBA_DUMP_HTML'] = str(args.annotate_html[0])
os.environ['NUMBA_DUMP_LLVM'] = str(int(args.dump_llvm))
os.environ['NUMBA_DUMP_OPTIMIZED'] = str(int(args.dump_optimized))
os.environ['NUMBA_DUMP_ASSEMBLY'] = str(int(args.dump_assembly))

cmd = [sys.executable, args.filename]
subprocess.call(cmd)

main()
6 changes: 4 additions & 2 deletions buildscripts/condarecipe.jenkins/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ source:

build:
number: {{ environ.get('GIT_DESCRIBE_NUMBER', 0) }}
#entry_points:
# - pycc = numba.pycc:main
entry_points:
- pycc = numba.pycc:main
- numba = numba.numba_entry:main

requirements:
build:
Expand All @@ -31,3 +32,4 @@ test:
- mandel.py
commands:
- pycc -h
- numba -h
4 changes: 4 additions & 0 deletions buildscripts/condarecipe.local/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ source:

build:
number: {{ environ.get('GIT_DESCRIBE_NUMBER', 0) }}
entry_points:
- pycc = numba.pycc:main
- numba = numba.numba_entry:main

requirements:
build:
Expand All @@ -29,3 +32,4 @@ test:
- mandel.py
commands:
- pycc -h
- numba -h
54 changes: 54 additions & 0 deletions numba/numba_entry.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
from __future__ import print_function, division, absolute_import

import sys
import argparse
import os
import subprocess


def make_parser():
parser = argparse.ArgumentParser()
parser.add_argument('--annotate', help='Annotate source',
action='store_true')
parser.add_argument('--dump-llvm', action="store_true",
help='Print generated llvm assembly')
parser.add_argument('--dump-optimized', action='store_true',
help='Dump the optimized llvm assembly')
parser.add_argument('--dump-assembly', action='store_true',
help='Dump the LLVM generated assembly')
parser.add_argument('--dump-cfg', action="store_true",
help='[Deprecated] Dump the control flow graph')
parser.add_argument('--dump-ast', action="store_true",
help='[Deprecated] Dump the AST')
parser.add_argument('--annotate-html', nargs=1,
help='Output source annotation as html')
parser.add_argument('filename', help='Python source filename')
return parser


def main():
parser = make_parser()
args = parser.parse_args()

if args.dump_cfg:
print("CFG dump is removed.")
sys.exit(1)
if args.dump_ast:
print("AST dump is removed. Numba no longer depends on AST.")
sys.exit(1)

os.environ['NUMBA_DUMP_ANNOTATION'] = str(int(args.annotate))
if args.annotate_html is not None:
try:
from jinja2 import Template
except ImportError:
raise ImportError("Please install the 'jinja2' package")
os.environ['NUMBA_DUMP_HTML'] = str(args.annotate_html[0])
os.environ['NUMBA_DUMP_LLVM'] = str(int(args.dump_llvm))
os.environ['NUMBA_DUMP_OPTIMIZED'] = str(int(args.dump_optimized))
os.environ['NUMBA_DUMP_ASSEMBLY'] = str(int(args.dump_assembly))

cmd = [sys.executable, args.filename]
subprocess.call(cmd)


0 comments on commit 0e4937f

Please sign in to comment.