Skip to content

Commit

Permalink
Make things work on systems defaulting to python3
Browse files Browse the repository at this point in the history
  • Loading branch information
jaseg committed Apr 13, 2016
1 parent 29b728f commit 6715fa1
Show file tree
Hide file tree
Showing 46 changed files with 77 additions and 76 deletions.
1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ and agreed to irrevocably license their contributions under the Duktape
* Bruce Pascoe <fatcerberus1@gmail.com>
* René Hollander <rene@rene8888.at>
* Julien Hamaide (https://github.com/crazyjul)
* Sebastian Götte (https://github.com/jaseg)

Other contributions
===================
Expand Down
34 changes: 17 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ NODE:=$(shell which nodejs node | head -1)
WGET:=$(shell which wget)
JAVA:=$(shell which java)
VALGRIND:=$(shell which valgrind)
PYTHON:=$(shell which python)
PYTHON:=$(shell which python2 python|head -1)

# Scrape version from the public header; convert from e.g. 10203 -> '1.2.3'
DUK_VERSION:=$(shell cat src/duk_api_public.h.in | grep define | grep DUK_VERSION | tr -s ' ' ' ' | cut -d ' ' -f 3 | tr -d 'L')
Expand Down Expand Up @@ -551,16 +551,16 @@ endif

.PHONY: matrix10
matrix10: dist
cd dist; python ../util/matrix_compile.py --count=10
cd dist; $(PYTHON) ../util/matrix_compile.py --count=10
.PHONY: matrix100
matrix100: dist
cd dist; python ../util/matrix_compile.py --count=100
cd dist; $(PYTHON) ../util/matrix_compile.py --count=100
.PHONY: matrix1000
matrix1000: dist
cd dist; python ../util/matrix_compile.py --count=1000
cd dist; $(PYTHON) ../util/matrix_compile.py --count=1000
.PHONY: matrix10000
matrix10000: dist
cd dist; python ../util/matrix_compile.py --count=10000
cd dist; $(PYTHON) ../util/matrix_compile.py --count=10000

regfuzz-0.1.tar.gz:
# https://code.google.com/p/regfuzz/
Expand Down Expand Up @@ -1044,7 +1044,7 @@ cloc: dist cloc-1.60.pl
# XXX: make prints a harmless warning related to the sub-make.
dist:
@make codepolicycheck
if [ -f compiler.jar ]; then python util/make_dist.py --minify closure --create-spdx; else python util/make_dist.py --minify none; fi
if [ -f compiler.jar ]; then $(PYTHON) util/make_dist.py --minify closure --create-spdx; else $(PYTHON) util/make_dist.py --minify none; fi

.PHONY: dist-src
dist-src: dist
Expand Down Expand Up @@ -1108,7 +1108,7 @@ endif
.PHONY: codepolicycheck
codepolicycheck:
@echo Code policy check
@python util/check_code_policy.py \
@$(PYTHON) util/check_code_policy.py \
$(CODEPOLICYOPTS) \
--check-debug-log-calls \
--check-carriage-returns \
Expand All @@ -1122,7 +1122,7 @@ codepolicycheck:
--check-cpp-comment \
--dump-vim-commands \
src/*.c src/*.h src/*.h.in tests/api/*.c
@python util/check_code_policy.py \
@$(PYTHON) util/check_code_policy.py \
$(CODEPOLICYOPTS) \
--check-debug-log-calls \
--check-carriage-returns \
Expand All @@ -1133,7 +1133,7 @@ codepolicycheck:
--check-nonleading-tab \
--dump-vim-commands \
tests/ecmascript/*.js
@python util/check_code_policy.py \
@$(PYTHON) util/check_code_policy.py \
$(CODEPOLICYOPTS) \
--check-carriage-returns \
--check-fixme \
Expand All @@ -1158,7 +1158,7 @@ codepolicycheck:
config/examples/* config/header-snippets/* config/helper-snippets/* \
config/*.yaml
# XXX: not yet FIXME pure
@python util/check_code_policy.py \
@$(PYTHON) util/check_code_policy.py \
$(CODEPOLICYOPTS) \
--check-carriage-returns \
--check-non-ascii \
Expand All @@ -1167,7 +1167,7 @@ codepolicycheck:
--check-nonleading-tab \
--dump-vim-commands \
config/config-options/*.yaml config/other-defines/*.yaml
@python util/check_code_policy.py \
@$(PYTHON) util/check_code_policy.py \
$(CODEPOLICYOPTS) \
--check-carriage-returns \
--check-fixme \
Expand All @@ -1177,7 +1177,7 @@ codepolicycheck:
--check-nonleading-tab \
--dump-vim-commands \
debugger/*.yaml
@python util/check_code_policy.py \
@$(PYTHON) util/check_code_policy.py \
$(CODEPOLICYOPTS) \
--check-carriage-returns \
--check-fixme \
Expand All @@ -1190,7 +1190,7 @@ codepolicycheck:

.PHONY: codepolicycheckvim
codepolicycheckvim:
-python util/check_code_policy.py --dump-vim-commands src/*.c src/*.h src/*.h.in tests/api/*.c
-$(PYTHON) util/check_code_policy.py --dump-vim-commands src/*.c src/*.h src/*.h.in tests/api/*.c

.PHONY: big-git-files
big-git-files:
Expand Down Expand Up @@ -1233,9 +1233,9 @@ massif-arcfour: massif-test-dev-arcfour
# - Node.js (V8) is JITed
# - Luajit is JITed

#TIME=python util/time_multi.py --count 1 --sleep 0 --sleep-factor 0.8 --mode min # Take minimum time of N
#TIME=python util/time_multi.py --count 3 --sleep 0 --sleep-factor 0.8 --mode min # Take minimum time of N
TIME=python util/time_multi.py --count 5 --sleep 0 --sleep-factor 0.8 --mode min # Take minimum time of N
#TIME=$(PYTHON) util/time_multi.py --count 1 --sleep 0 --sleep-factor 0.8 --mode min # Take minimum time of N
#TIME=$(PYTHON) util/time_multi.py --count 3 --sleep 0 --sleep-factor 0.8 --mode min # Take minimum time of N
TIME=$(PYTHON) util/time_multi.py --count 5 --sleep 0 --sleep-factor 0.8 --mode min # Take minimum time of N

# Blocks: optimization variants, previous versions, other interpreting engines,
# other JIT engines.
Expand All @@ -1254,7 +1254,7 @@ perftest: duk duk.O2 duk.O3 duk.O4
printf ' |'; \
printf ' mujs %5s' "`$(TIME) mujs $$i`"; \
printf ' lua %5s' "`$(TIME) lua $${i%%.js}.lua`"; \
printf ' python %5s' "`$(TIME) python $${i%%.js}.py`"; \
printf ' python %5s' "`$(TIME) $(PYTHON) $${i%%.js}.py`"; \
printf ' perl %5s' "`$(TIME) perl $${i%%.js}.pl`"; \
printf ' ruby %5s' "`$(TIME) ruby $${i%%.js}.rb`"; \
printf ' |'; \
Expand Down
2 changes: 1 addition & 1 deletion config/extract_unique_options.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python2
#
# Extract unique DUK_USE_xxx flags from current code base:
#
Expand Down
2 changes: 1 addition & 1 deletion config/genconfig.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python2
#
# Process Duktape option metadata and produce various useful outputs:
#
Expand Down
2 changes: 1 addition & 1 deletion debugger/merge_debug_meta.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python2
#
# Merge debugger YAML metadata files and output a merged JSON metadata file.
#
Expand Down
2 changes: 1 addition & 1 deletion debugger/util/heapjson_convert.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python2
#
# Convert a HeapDump JSON file into a more useful format.
#
Expand Down
2 changes: 1 addition & 1 deletion examples/alloc-logging/log2gnuplot.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python2
#
# Analyze allocator logs and write total-bytes-in-use after every
# operation to stdout. The output can be gnuplotted as:
Expand Down
2 changes: 1 addition & 1 deletion examples/alloc-logging/pool_simulator.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python2
#
# Simulate pool allocator behavior against a memory allocation log written
# by duk_alloc_logging.c or in matching format. Provide commands to provide
Expand Down
2 changes: 1 addition & 1 deletion misc/c_overflow_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python2

import math

Expand Down
2 changes: 1 addition & 1 deletion misc/chaos.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python2
#
# $ ./duk test-dev-chaos.js | python chaos.py > chaos.raw
# $ sox -r 8k -e unsigned -b 8 -c 1 chaos.raw chaos.wav
Expand Down
2 changes: 1 addition & 1 deletion src/dukutil.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python2
#
# Python utilities shared by the build scripts.
#
Expand Down
2 changes: 1 addition & 1 deletion src/extract_caseconv.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python2
#
# Extract rules for Unicode case conversion, specifically the behavior
# required by Ecmascript E5 in Sections 15.5.4.16 to 15.5.4.19. The
Expand Down
2 changes: 1 addition & 1 deletion src/extract_chars.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python2
#
# Select a set of Unicode characters (based on included/excluded categories
# etc) and write out a compact bitstream for matching a character against
Expand Down
2 changes: 1 addition & 1 deletion src/genbuildparams.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python2
#
# Generate build parameter files based on build information.
# A C header is generated for C code, and a JSON file for
Expand Down
2 changes: 1 addition & 1 deletion src/genbuiltins.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python2
#
# Generate initialization data for built-in strings and objects.
#
Expand Down
2 changes: 1 addition & 1 deletion src/gendoubleconsts.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python2

# Double constants, see http://en.wikipedia.org/wiki/Double-precision_floating-point_format.
# Some double constants have been created with 'python-mpmath'. The constants are in binary
Expand Down
2 changes: 1 addition & 1 deletion src/genequivyear.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python2
#
# Generate equivalent year table needed by duk_bi_date.c. Based on:
#
Expand Down
2 changes: 1 addition & 1 deletion src/genexesizereport.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python2
#
# Generate a size report from a Duktape library / executable.
# Write out useful information about function sizes in a variety
Expand Down
2 changes: 1 addition & 1 deletion src/genhashsizes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python2
#
# Find a sequence of duk_hobject hash sizes which have a desired 'ratio'
# and are primes. Prime hash sizes ensure that all probe sequence values
Expand Down
2 changes: 1 addition & 1 deletion src/gennumdigits.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python2
#
# Generate a table indicating how many digits should be considered
# significant for each radix (2 to 36) when doing string-to-number
Expand Down
2 changes: 1 addition & 1 deletion src/genobjsizereport.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python2
#
# Size report of (stripped) object and source files.
#
Expand Down
2 changes: 1 addition & 1 deletion src/prepare_unicode_data.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python2
#
# UnicodeData.txt may contain ranges in addition to individual characters.
# Unpack the ranges into individual characters for the other scripts to use.
Expand Down
2 changes: 1 addition & 1 deletion src/scan_used_stridx_bidx.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python2
#
# Scan Duktape code base for references to built-in strings and built-in
# objects, i.e. for:
Expand Down
2 changes: 1 addition & 1 deletion util/autofix_debuglog_calls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python2
#
# Automatically fix one-line broken debug log calls. Adds a missing
# wrapper for such lines, e.g. changes:
Expand Down
2 changes: 1 addition & 1 deletion util/check_code_policy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python2
#
# Check various C source code policy rules and issue warnings for offenders
#
Expand Down
2 changes: 1 addition & 1 deletion util/combine_src.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python2
#
# Combine all source and header files in source directory into
# a single C file.
Expand Down
2 changes: 1 addition & 1 deletion util/create_spdx_license.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python2
#
# Helper to create an SPDX license file (http://spdx.org)
#
Expand Down
2 changes: 1 addition & 1 deletion util/ditz_hack.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python2
#
# Throwaway utility to dump Ditz issues for grooming.
#
Expand Down
2 changes: 1 addition & 1 deletion util/duk_meta_to_strarray.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python2
#
# Create an array of C strings with Duktape built-in strings.
# Useful when using external strings.
Expand Down
2 changes: 1 addition & 1 deletion util/dump_bytecode.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python2
#
# Utility to dump bytecode into a human readable form.
#
Expand Down
2 changes: 1 addition & 1 deletion util/fastint_reps.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python2
#
# Print out a few IEEE double representations related to the Duktape fastint
# number model.
Expand Down
2 changes: 1 addition & 1 deletion util/filter_test262_log.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python2

import os
import sys
Expand Down
2 changes: 1 addition & 1 deletion util/find_func_calls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python2
#
# Extract function call names from source C/H files.
#
Expand Down
2 changes: 1 addition & 1 deletion util/find_non_ascii.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python2
#
# Example:
#
Expand Down
2 changes: 1 addition & 1 deletion util/fix_emscripten.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python2
#
# Fix a few errors from Emscripten output (stopgap until emscripten mainline
# is updated).
Expand Down
2 changes: 1 addition & 1 deletion util/format_perftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python2
#
# Format a perftest text dump into a HTML table.

Expand Down
2 changes: 1 addition & 1 deletion util/make_ascii.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python2
#
# Paranoia escape input file to be printable ASCII.
#
Expand Down
Loading

0 comments on commit 6715fa1

Please sign in to comment.