blob: 6051f8fcd269aa2739356f456115c95da807a614 [file] [log] [blame]
Yang Guo4fd355c2019-09-19 10:59:03 +02001#!/usr/bin/env python
2#
3# Copyright 2019 The Chromium Authors. All rights reserved.
4# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6
7import os
8import sys
9import json
10import devtools_paths
11
12
13def run_assert():
14 assert_errors_found = False
15 try:
16 with open(devtools_paths.package_json_path(), 'r') as pkg_file:
17 pkg = json.load(pkg_file)
18 if 'dependencies' in pkg:
19 print('dependencies property found in package.json')
20 assert_errors_found = True
21 if 'devDependencies' in pkg:
22 print('devDependencies property found in package.json')
23 assert_errors_found = True
24 except ValueError:
25 print('Unable to parse package.json')
26 assert_errors_found = True
27 except FileNotFoundError:
28 print('Unable to find package.json')
29 assert_errors_found = True
30
31 return assert_errors_found
32
33
34errors_found = run_assert()
35
36if errors_found:
37 print("ERRORS DETECTED")
38 sys.exit(1)