[gnome-continuous-yocto/gnomeostree-3.28-rocko: 6596/8267] yocto-compat-layer.py: allow README with suffix
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-continuous-yocto/gnomeostree-3.28-rocko: 6596/8267] yocto-compat-layer.py: allow README with suffix
- Date: Sun, 17 Dec 2017 05:04:01 +0000 (UTC)
commit 17266ae2dd2c5a22c7af84427b0ca11de481c21d
Author: Patrick Ohly <patrick ohly intel com>
Date: Tue Jun 27 17:33:42 2017 +0200
yocto-compat-layer.py: allow README with suffix
It may be useful to append a suffix denoting the file format. For
example, README.rst is rendered differently when viewed on Github, and
also helps editors to switch to a mode more suitable for the format.
The tests uses a file pattern to find the README file(s) and treats
the one with the shortest name as the main one which must not be
empty.
(From OE-Core rev: 501b5b7f338396a4a115355b8a78ae5b03f67d9a)
Signed-off-by: Patrick Ohly <patrick ohly intel com>
Signed-off-by: Ross Burton <ross burton intel com>
Signed-off-by: Richard Purdie <richard purdie linuxfoundation org>
scripts/lib/compatlayer/cases/common.py | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/scripts/lib/compatlayer/cases/common.py b/scripts/lib/compatlayer/cases/common.py
index ede002d..4c8a543 100644
--- a/scripts/lib/compatlayer/cases/common.py
+++ b/scripts/lib/compatlayer/cases/common.py
@@ -1,6 +1,7 @@
# Copyright (C) 2017 Intel Corporation
# Released under the MIT license (see COPYING.MIT)
+import glob
import os
import unittest
from compatlayer import get_signatures, LayerType, check_command, get_depgraph
@@ -8,15 +9,20 @@ from compatlayer.case import OECompatLayerTestCase
class CommonCompatLayer(OECompatLayerTestCase):
def test_readme(self):
- readme_file = os.path.join(self.tc.layer['path'], 'README')
- self.assertTrue(os.path.isfile(readme_file),
- msg="Layer doesn't contains README file.")
+ # The top-level README file may have a suffix (like README.rst or README.txt).
+ readme_files = glob.glob(os.path.join(self.tc.layer['path'], 'README*'))
+ self.assertTrue(len(readme_files) > 0,
+ msg="Layer doesn't contains README file.")
+ # There might be more than one file matching the file pattern above
+ # (for example, README.rst and README-COPYING.rst). The one with the shortest
+ # name is considered the "main" one.
+ readme_file = sorted(readme_files)[0]
data = ''
with open(readme_file, 'r') as f:
data = f.read()
self.assertTrue(data,
- msg="Layer contains README file but is empty.")
+ msg="Layer contains a README file but it is empty.")
def test_parse(self):
check_command('Layer %s failed to parse.' % self.tc.layer['name'],
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]