From 3c9431128e1f50538fa6bae7f61f47420b6f0a09 Mon Sep 17 00:00:00 2001 From: lethosor Date: Mon, 23 Feb 2015 18:44:19 -0500 Subject: [PATCH 1/4] travis: Ignore protobuf generated files --- travis/lint.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/travis/lint.py b/travis/lint.py index 2b41e5987..74be3e853 100644 --- a/travis/lint.py +++ b/travis/lint.py @@ -3,13 +3,14 @@ import re, os, sys valid_extensions = ['c', 'cpp', 'h', 'hpp', 'mm', 'lua', 'rb', 'proto', 'init', 'init-example'] path_blacklist = [ - 'library/include/df/', - 'plugins/stonesense/allegro', - 'plugins/isoworld/allegro', - 'plugins/isoworld/agui', - 'depends/', - '.git/', - 'build', + '^library/include/df/', + '^plugins/stonesense/allegro', + '^plugins/isoworld/allegro', + '^plugins/isoworld/agui', + '^depends/', + '^.git/', + '^build', + '.pb.h', ] def valid_file(filename): @@ -93,7 +94,7 @@ def main(): sys.exit(2) fix = (len(sys.argv) > 2 and sys.argv[2] == '--fix') global path_blacklist - path_blacklist = map(lambda s: os.path.join(root_path, s), path_blacklist) + path_blacklist = map(lambda s: os.path.join(root_path, s.replace('^', '')) if s.startswith('^') else s, path_blacklist) for cur, dirnames, filenames in os.walk(root_path): for filename in filenames: From 0aa9866089e8c4a7c8e92014253ddd128e19d1d9 Mon Sep 17 00:00:00 2001 From: lethosor Date: Mon, 23 Feb 2015 18:44:36 -0500 Subject: [PATCH 2/4] travis: Add luac test --- .travis.yml | 8 +++++++- travis/luac.py | 26 ++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 travis/luac.py diff --git a/.travis.yml b/.travis.yml index a12b9d853..f5efebc55 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,12 @@ language: cpp +env: + matrix: + -LUA_VERSION=5.2 +before_install: +- sudo apt-get install lua$LUA_VERSION script: -- python travis/lint.py - python travis/pr-check-base.py +- python travis/lint.py +- python travis/luac.py notifications: email: false diff --git a/travis/luac.py b/travis/luac.py new file mode 100644 index 000000000..80a28cc53 --- /dev/null +++ b/travis/luac.py @@ -0,0 +1,26 @@ +import os, sys, subprocess + +def main(): + root_path = os.path.abspath(sys.argv[1] if len(sys.argv) > 1 else '.') + if not os.path.exists(root_path): + print('Nonexistent path: %s' % root_path) + sys.exit(2) + err = False + for cur, dirnames, filenames in os.walk(root_path): + parts = cur.replace('\\', '/').split('/') + if '.git' in parts or 'depends' in parts: + continue + if '.git' in cur: + print(parts) + for filename in filenames: + if not filename.endswith('.lua'): + continue + full_path = os.path.join(cur, filename) + try: + subprocess.call(['luac' + os.environ.get('LUA_VERSION', ''), '-p', full_path]) + except subprocess.CalledProcessError: + err = True + sys.exit(int(err)) + +if __name__ == '__main__': + main() From 5c09423aeacd471460682da94eba849ab0b3e06d Mon Sep 17 00:00:00 2001 From: lethosor Date: Mon, 23 Feb 2015 18:55:34 -0500 Subject: [PATCH 3/4] Make luac exit with correct error code --- travis/luac.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/travis/luac.py b/travis/luac.py index 80a28cc53..19ae4b9ee 100644 --- a/travis/luac.py +++ b/travis/luac.py @@ -17,8 +17,8 @@ def main(): continue full_path = os.path.join(cur, filename) try: - subprocess.call(['luac' + os.environ.get('LUA_VERSION', ''), '-p', full_path]) - except subprocess.CalledProcessError: + assert not subprocess.call(['luac' + os.environ.get('LUA_VERSION', ''), '-p', full_path]) + except (subprocess.CalledProcessError, AssertionError): err = True sys.exit(int(err)) From 83e175f52b108fe59d1c6036239096cfd83937ef Mon Sep 17 00:00:00 2001 From: lethosor Date: Mon, 23 Feb 2015 18:57:50 -0500 Subject: [PATCH 4/4] Fix syntax error in devel/light.lua --- scripts/devel/light.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/devel/light.lua b/scripts/devel/light.lua index 111d12b46..532a3a4f5 100644 --- a/scripts/devel/light.lua +++ b/scripts/devel/light.lua @@ -178,7 +178,7 @@ function LightOverlay:placeLightFov2(pos,radius,color,f,rays) local cy=0 for dt=0,radius,0.01 do - if math.abs(math.floor(dt*dx)-cx)>0 or math.abs(math.floor(dt*dy)-cy)> 0then + if math.abs(math.floor(dt*dx)-cx)>0 or math.abs(math.floor(dt*dy)-cy)> 0 then local x=cx+pos.x local y=cy+pos.y @@ -374,4 +374,4 @@ end local dyn=true if #args>0 and args[1]=="static" then dyn=false end local lview = LightOverlay{ dynamic=dyn} -lview:show() \ No newline at end of file +lview:show()