瀏覽代碼

Sync ci/files with ws17-ci repo

Michael Mächtel 8 年之前
父節點
當前提交
8c63a81d39
共有 3 個檔案被更改,包括 16 行新增6 行删除
  1. 1
    1
      ci/check-basic-style.py
  2. 14
    4
      ci/check-files.py
  3. 1
    1
      ci/run-travis.sh

+ 1
- 1
ci/check-basic-style.py 查看文件

@@ -1,4 +1,4 @@
1
-#!/usr/bin/env python
1
+#!/usr/bin/env python2
2 2
 from __future__ import print_function
3 3
 
4 4
 # Checks

+ 14
- 4
ci/check-files.py 查看文件

@@ -1,12 +1,18 @@
1
-#!/usr/bin/env python
1
+#!/usr/bin/env python2
2 2
 from __future__ import print_function
3 3
 
4
+import re
5
+import sys
6
+
4 7
 from os import listdir
5 8
 from os.path import dirname, isfile, join, isdir
6 9
 
7 10
 ROOT_DIR = join(dirname(__file__), '..')
8 11
 FILES_FOLDER = join(ROOT_DIR, 'files')
9 12
 
13
+def natural_sort_key(value):
14
+    return [int(s) if s.isdigit() else s.lower() for s in re.split(r"(\d+)", value)]
15
+
10 16
 
11 17
 def get_file_lists():
12 18
     if not isdir(FILES_FOLDER):
@@ -41,13 +47,17 @@ def check_files(file_list):
41 47
             errors += 1
42 48
 
43 49
     if errors == 0:
50
+        return True
44 51
         print(" -> All Files found.")
52
+    return False
45 53
 
46 54
 
47 55
 def main():
48
-    for f, file_list in get_file_lists().items():
49
-        print(f)
50
-        check_files(file_list)
56
+    file_lists = get_file_lists()
57
+    newest_folder = sorted(file_lists.keys(), key=natural_sort_key)[-1]
58
+    print(newest_folder)
59
+    if not check_files(file_lists[newest_folder]):
60
+        sys.exit(1)
51 61
 
52 62
 
53 63
 if __name__ == '__main__':

+ 1
- 1
ci/run-travis.sh 查看文件

@@ -13,7 +13,7 @@ MY_PATH="$(dirname "$0")"
13 13
 
14 14
 # file existence
15 15
 echo "=== Checking for Missing Files ======================================="
16
-"$MY_PATH/check-files.py"
16
+"$MY_PATH/check-files.py" || true
17 17
 
18 18
 echo "++++++++++++++++++++++++++++++++++++++++++++++++++++"
19 19
 echo "+              Everything is fine!                 +"

Loading…
取消
儲存