diff options
| author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2017-01-31 13:32:03 +0200 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-02-02 17:37:44 +0000 |
| commit | 2d6f96048eb698f741b33c533b8eb15c19cc1f1d (patch) | |
| tree | 8eab74694969f7f17aff4034ec2ca2b01dee1ecd /scripts/lib/wic/utils/misc.py | |
| parent | 759c24c404509b9d415d6f05e316553503b376b4 (diff) | |
| download | poky-2d6f96048eb698f741b33c533b8eb15c19cc1f1d.tar.gz | |
wic: move 2 APIs to wic.engine
Moved find_canned and get_custom_config APIs to engine module.
Removed empty wic.utils.misc module.
[YOCTO #10619]
(From OE-Core rev: 10e9afac46575d3f557b7cb505daa31ce9ce85fa)
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/wic/utils/misc.py')
| -rw-r--r-- | scripts/lib/wic/utils/misc.py | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/scripts/lib/wic/utils/misc.py b/scripts/lib/wic/utils/misc.py deleted file mode 100644 index 7d09f6fc26..0000000000 --- a/scripts/lib/wic/utils/misc.py +++ /dev/null | |||
| @@ -1,56 +0,0 @@ | |||
| 1 | #!/usr/bin/env python -tt | ||
| 2 | # | ||
| 3 | # Copyright (c) 2010, 2011 Intel Inc. | ||
| 4 | # | ||
| 5 | # This program is free software; you can redistribute it and/or modify it | ||
| 6 | # under the terms of the GNU General Public License as published by the Free | ||
| 7 | # Software Foundation; version 2 of the License | ||
| 8 | # | ||
| 9 | # This program is distributed in the hope that it will be useful, but | ||
| 10 | # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
| 11 | # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
| 12 | # for more details. | ||
| 13 | # | ||
| 14 | # You should have received a copy of the GNU General Public License along | ||
| 15 | # with this program; if not, write to the Free Software Foundation, Inc., 59 | ||
| 16 | # Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
| 17 | |||
| 18 | import os | ||
| 19 | import time | ||
| 20 | import wic.engine | ||
| 21 | |||
| 22 | def find_canned(scripts_path, file_name): | ||
| 23 | """ | ||
| 24 | Find a file either by its path or by name in the canned files dir. | ||
| 25 | |||
| 26 | Return None if not found | ||
| 27 | """ | ||
| 28 | if os.path.exists(file_name): | ||
| 29 | return file_name | ||
| 30 | |||
| 31 | layers_canned_wks_dir = wic.engine.build_canned_image_list(scripts_path) | ||
| 32 | for canned_wks_dir in layers_canned_wks_dir: | ||
| 33 | for root, dirs, files in os.walk(canned_wks_dir): | ||
| 34 | for fname in files: | ||
| 35 | if fname == file_name: | ||
| 36 | fullpath = os.path.join(canned_wks_dir, fname) | ||
| 37 | return fullpath | ||
| 38 | |||
| 39 | def get_custom_config(boot_file): | ||
| 40 | """ | ||
| 41 | Get the custom configuration to be used for the bootloader. | ||
| 42 | |||
| 43 | Return None if the file can't be found. | ||
| 44 | """ | ||
| 45 | scripts_path = os.path.abspath(os.path.dirname(__file__)) | ||
| 46 | # Get the scripts path of poky | ||
| 47 | for x in range(0, 3): | ||
| 48 | scripts_path = os.path.dirname(scripts_path) | ||
| 49 | |||
| 50 | cfg_file = find_canned(scripts_path, boot_file) | ||
| 51 | if cfg_file: | ||
| 52 | with open(cfg_file, "r") as f: | ||
| 53 | config = f.read() | ||
| 54 | return config | ||
| 55 | |||
| 56 | return None | ||
