[damned-lies] Make MakefileWrapper aware of its branch



commit b8a636260fc47c57fbd26f57f3161895c3e6acad
Author: Claude Paroz <claude 2xlibre net>
Date:   Wed Mar 28 11:33:13 2018 +0200

    Make MakefileWrapper aware of its branch

 stats/models.py                                    |    4 +-
 .../help_docbook/C/figures/rnusers.nautilus.png    |  Bin 844 -> 844 bytes
 .../testmodule}/help_docbook/C/release-notes.xml   |    0
 .../help_docbook/C/rnlookingforward.xml            |    0
 .../testmodule}/help_docbook/C/rnusers.xml         |    0
 .../{ => git/testmodule}/help_docbook/Makefile.am  |    0
 .../help_mallard/C/figures/gnome-hello-logo.png    |  Bin 3388 -> 3388 bytes
 .../help_mallard/C/figures/gnome-hello.png         |  Bin 9480 -> 9480 bytes
 .../{ => git/testmodule}/help_mallard/C/index.page |    0
 .../{ => git/testmodule}/help_mallard/C/legal.xml  |    0
 .../testmodule}/help_mallard/C/what-is.page        |    0
 .../testmodule}/help_mallard/CMakeLists.txt        |    0
 .../{ => git/testmodule}/help_mallard/Makefile.am  |    0
 .../help_mallard/fr/figures/gnome-hello.png        |  Bin 0 -> 15690 bytes
 stats/tests/git/testmodule/help_mallard/fr/fr.po   |  266 ++++++++++++++++++++
 .../{ => git/testmodule}/help_mallard/meson.build  |    0
 stats/tests/tests.py                               |   56 +++--
 stats/utils.py                                     |   15 +-
 18 files changed, 316 insertions(+), 25 deletions(-)
---
diff --git a/stats/models.py b/stats/models.py
index 8d70a2d..0327be4 100644
--- a/stats/models.py
+++ b/stats/models.py
@@ -898,13 +898,13 @@ class Domain(models.Model):
             )
         # Parse and use content from: "XGETTEXT_OPTIONS = --keyword=_ --keyword=N_"
         vcs_path = branch.co_path / self.directory
-        makefile = utils.MakefileWrapper.find_file([vcs_path], file_name='Makevars')
+        makefile = utils.MakefileWrapper.find_file(branch, [vcs_path], file_name='Makevars')
         if makefile:
             kwds_vars = makefile.read_variable('XGETTEXT_OPTIONS')
             if kwds_vars:
                 pot_command.extend(kwds_vars.split())
         else:
-            makefile = utils.MakefileWrapper.find_file([vcs_path], file_name='meson.build')
+            makefile = utils.MakefileWrapper.find_file(branch, [vcs_path], file_name='meson.build')
             if makefile:
                 if makefile.read_variable('gettext.preset') == 'glib' or not makefile.readable:
                     # These args should be kept in sync with
diff --git a/stats/tests/help_docbook/C/release-notes.xml 
b/stats/tests/git/testmodule/help_docbook/C/release-notes.xml
similarity index 100%
rename from stats/tests/help_docbook/C/release-notes.xml
rename to stats/tests/git/testmodule/help_docbook/C/release-notes.xml
diff --git a/stats/tests/help_docbook/C/rnlookingforward.xml 
b/stats/tests/git/testmodule/help_docbook/C/rnlookingforward.xml
similarity index 100%
rename from stats/tests/help_docbook/C/rnlookingforward.xml
rename to stats/tests/git/testmodule/help_docbook/C/rnlookingforward.xml
diff --git a/stats/tests/help_docbook/C/rnusers.xml b/stats/tests/git/testmodule/help_docbook/C/rnusers.xml
similarity index 100%
rename from stats/tests/help_docbook/C/rnusers.xml
rename to stats/tests/git/testmodule/help_docbook/C/rnusers.xml
diff --git a/stats/tests/help_docbook/Makefile.am b/stats/tests/git/testmodule/help_docbook/Makefile.am
similarity index 100%
rename from stats/tests/help_docbook/Makefile.am
rename to stats/tests/git/testmodule/help_docbook/Makefile.am
diff --git a/stats/tests/help_mallard/C/index.page b/stats/tests/git/testmodule/help_mallard/C/index.page
similarity index 100%
rename from stats/tests/help_mallard/C/index.page
rename to stats/tests/git/testmodule/help_mallard/C/index.page
diff --git a/stats/tests/help_mallard/C/legal.xml b/stats/tests/git/testmodule/help_mallard/C/legal.xml
similarity index 100%
rename from stats/tests/help_mallard/C/legal.xml
rename to stats/tests/git/testmodule/help_mallard/C/legal.xml
diff --git a/stats/tests/help_mallard/C/what-is.page b/stats/tests/git/testmodule/help_mallard/C/what-is.page
similarity index 100%
rename from stats/tests/help_mallard/C/what-is.page
rename to stats/tests/git/testmodule/help_mallard/C/what-is.page
diff --git a/stats/tests/help_mallard/CMakeLists.txt b/stats/tests/git/testmodule/help_mallard/CMakeLists.txt
similarity index 100%
rename from stats/tests/help_mallard/CMakeLists.txt
rename to stats/tests/git/testmodule/help_mallard/CMakeLists.txt
diff --git a/stats/tests/help_mallard/Makefile.am b/stats/tests/git/testmodule/help_mallard/Makefile.am
similarity index 100%
rename from stats/tests/help_mallard/Makefile.am
rename to stats/tests/git/testmodule/help_mallard/Makefile.am
diff --git a/stats/tests/git/testmodule/help_mallard/fr/figures/gnome-hello.png 
b/stats/tests/git/testmodule/help_mallard/fr/figures/gnome-hello.png
new file mode 100644
index 0000000..53d96f7
Binary files /dev/null and b/stats/tests/git/testmodule/help_mallard/fr/figures/gnome-hello.png differ
diff --git a/stats/tests/git/testmodule/help_mallard/fr/fr.po 
b/stats/tests/git/testmodule/help_mallard/fr/fr.po
new file mode 100644
index 0000000..091f3aa
--- /dev/null
+++ b/stats/tests/git/testmodule/help_mallard/fr/fr.po
@@ -0,0 +1,266 @@
+# French translation of gnome-hello documentation.
+# Copyright (C) 2008-2012 Free Software Foundation, Inc.
+# This file is distributed under the same license as the gnome-hello documentation package.
+#
+# Thomas Bordinat <ulti lldc fr>, 2008
+# Bruno Brouard <annoa b gmail com>, 2008
+# Alain Lojewski <allomervan gmail com>, 2011-2013
+# Mickael Albertus <mickael albertus gmail com>, 2012.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: GNOME Hello 2.0\n"
+"POT-Creation-Date: 2012-12-27 21:29+0000\n"
+"PO-Revision-Date: 2013-02-26 16:33+0100\n"
+"Last-Translator: Alain Lojewski <allomervan gmail com>\n"
+"Language-Team: GNOME French Team <gnomefr traduc org>\n"
+"Language: fr\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n > 1);\n"
+"X-Generator: Gtranslator 2.91.5\n"
+
+#. This is a reference to an external file such as an image or video. When
+#. the file changes, the md5 hash will change to let you know you need to
+#. update your localized copy. The msgstr is not used at all. Set it to
+#. whatever you like once you have updated your copy of the file.
+#.
+#. This is a reference to an external file such as an image or video. When
+#. the file changes, the md5 hash will change to let you know you need to
+#. update your localized copy. The msgstr is not used at all. Set it to
+#. whatever you like once you have updated your copy of the file.
+#.
+#. This is a reference to an external file such as an image or video. When
+#. the file changes, the md5 hash will change to let you know you need to
+#. update your localized copy. The msgstr is not used at all. Set it to
+#. whatever you like once you have updated your copy of the file.
+#.
+#. This is a reference to an external file such as an image or video. When
+#. the file changes, the md5 hash will change to let you know you need to
+#. update your localized copy. The msgstr is not used at all. Set it to
+#. whatever you like once you have updated your copy of the file.
+#: C/index.page:7(media) C/index.page:26(media)
+msgctxt "_"
+msgid ""
+"external ref='figures/gnome-hello-logo.png' "
+"md5='1ae47b7a7c4fbeb1f6bb72c0cf18d389'"
+msgstr ""
+"external ref='figures/gnome-hello-logo.png' "
+"md5='1ae47b7a7c4fbeb1f6bb72c0cf18d389'"
+
+#: C/index.page:6(info/desc)
+msgid "Help for GNOME Hello."
+msgstr "Aide de GNOME Hello."
+
+#: C/index.page:8(info/title)
+msgctxt "text"
+msgid "GNOME Hello"
+msgstr "GNOME Hello"
+
+#: C/index.page:11(credit/name) C/what-is.page:10(credit/name)
+#: C/what-is-like.page:11(credit/name) C/what-can-do.page:10(credit/name)
+msgid "Milo Casagrande"
+msgstr "Milo Casagrande"
+
+#: C/index.page:15(credit/name) C/compiling.page:10(credit/name)
+msgid "Tiffany Antopolski"
+msgstr "Tiffany Antopolski"
+
+#: C/index.page:20(license/p) C/compiling.page:15(license/p)
+#: C/what-is.page:15(license/p) C/what-is-like.page:16(license/p)
+#: C/what-can-do.page:15(license/p)
+msgid "Creative Commons Share Alike 3.0"
+msgstr "Creative Commons Partage des conditions initiales à l'identique 3.0"
+
+#: C/index.page:26(page/title)
+msgid ""
+"<media type=\"image\" src=\"figures/gnome-hello-logo.png\">GNOME Hello logo</"
+"media>GNOME Hello"
+msgstr ""
+"<media type=\"image\" src=\"figures/gnome-hello-logo.png\">Logo de GNOME "
+"Hello</media>GNOME Hello"
+
+#: C/index.page:28(section/title)
+msgid "Introduction"
+msgstr "Introduction"
+
+#: C/index.page:32(section/title)
+msgid "It's a small world"
+msgstr "C'est un petit monde"
+
+#: C/index.page:36(section/title)
+msgid "Advanced"
+msgstr "Avancé"
+
+#: C/compiling.page:7(info/desc)
+msgid ""
+"<link xref=\"get#compile\">Compile</link> and <link xref=\"get#run\">run</"
+"link> and <link xref=\"get#help\">more</link>."
+msgstr ""
+"<link xref=\"get#compile\">Compiler</link>, <link xref=\"get#run\">lancer</"
+"link> et <link xref=\"get#help\">plus encore</link>."
+
+#: C/compiling.page:21(page/title)
+msgid "Get <app>GNOME Hello</app>"
+msgstr "Obtenir <app>GNOME Hello</app>"
+
+#: C/compiling.page:24(section/title)
+msgid "Compile"
+msgstr "Compiler"
+
+#: C/compiling.page:25(section/p)
+msgid "To compile the app from source:"
+msgstr "Pour compiler l'application à partir des sources :"
+
+#: C/compiling.page:29(item/p)
+msgid "In a terminal, type:"
+msgstr "Dans un terminal, saisissez :"
+
+#: C/compiling.page:30(item/p)
+msgid "<cmd>git clone git://git.gnome.org/gnome-hello</cmd>"
+msgstr "<cmd>git clone git://git.gnome.org/gnome-hello</cmd>"
+
+#: C/compiling.page:31(item/p)
+msgid "<cmd>cd gnome-hello</cmd>"
+msgstr "<cmd>cd gnome-hello</cmd>"
+
+#: C/compiling.page:32(item/p)
+msgid "<cmd>./autogen.sh --prefix=`pwd`/install</cmd>"
+msgstr "<cmd>./autogen.sh --prefix=`pwd`/install</cmd>"
+
+#: C/compiling.page:33(item/p)
+msgid "<cmd>make</cmd>"
+msgstr "<cmd>make</cmd>"
+
+#: C/compiling.page:34(item/p)
+msgid "<cmd>make install</cmd>"
+msgstr "<cmd>make install</cmd>"
+
+#: C/compiling.page:39(section/title)
+msgid "Run"
+msgstr "Lancer"
+
+#: C/compiling.page:40(section/p)
+msgid "To run gnome-hello type:"
+msgstr "Pour lancer gnome-hello, saisissez :"
+
+#: C/compiling.page:43(section/p)
+msgid "<cmd>./src/gnome-hello</cmd>"
+msgstr "<cmd>./src/gnome-hello</cmd>"
+
+#: C/compiling.page:49(section/title)
+msgid "View most up-to-date help pages"
+msgstr "Afficher les pages d'aide les plus à jour"
+
+#: C/compiling.page:50(section/p)
+msgid ""
+"To run most recent help pages (and view your changes if you made any) type:"
+msgstr ""
+"Pour afficher les pages d'aide les plus récentes (et voir vos modifications "
+"si vous en avez faites), saisissez :"
+
+#: C/compiling.page:53(section/p)
+msgid "<cmd>yelp help/C/</cmd>"
+msgstr "<cmd>yelp help/C/</cmd>"
+
+# Missing </app> to generate an error in tests
+#: C/what-is.page:7(info/desc)
+msgid "Description of <app>GNOME Hello</app>."
+msgstr "Description de <app>GNOME Hello</app>."
+
+#: C/what-is.page:21(page/title)
+msgid "What is <app>GNOME Hello</app>"
+msgstr "Qu'est-ce que <app>GNOME Hello</app> ?"
+
+#: C/what-is.page:23(page/p)
+msgid ""
+"<app>GNOME Hello</app> is a very complex program, with many nice features "
+"and nice options."
+msgstr ""
+"<app>GNOME Hello</app> est un programme très complexe, avec beaucoup de "
+"fonctionnalités intéressantes et des options sympathiques."
+
+#. This is a reference to an external file such as an image or video. When
+#. the file changes, the md5 hash will change to let you know you need to
+#. update your localized copy. The msgstr is not used at all. Set it to
+#. whatever you like once you have updated your copy of the file.
+#: C/what-is-like.page:28(media)
+msgctxt "_"
+msgid ""
+"external ref='figures/gnome-hello-new.png' "
+"md5='8a1fcc6f46a22a1f500cfef9ca51b481'"
+msgstr ""
+"external ref='figures/gnome-hello-new.png' "
+"md5='8a1fcc6f46a22a1f500cfef9ca51b481'"
+
+#: C/what-is-like.page:8(info/desc)
+msgid "Pictures of <app>GNOME Hello</app>."
+msgstr "Images de <app>GNOME Hello</app>."
+
+#: C/what-is-like.page:22(page/title)
+msgid "What does <app>GNOME Hello</app> look like?"
+msgstr "À quoi ressemble <app>GNOME Hello</app> ?"
+
+#: C/what-is-like.page:24(page/p)
+msgid "This is how <app>GNOME Hello</app> looks like."
+msgstr "Voici à quoi ressemble <app>GNOME Hello</app>."
+
+#: C/what-is-like.page:27(page/p)
+msgid ""
+"<media type=\"image\" mime=\"img/png\" src=\"figures/gnome-hello-new.png\"> "
+"<app>GNOME Hello</app> fantastic interface. </media>"
+msgstr ""
+"<media type=\"image\" mime=\"img/png\" src=\"figures/gnome-hello-new.png\"> "
+"la fantastique interface de <app>GNOME Hello</app>. </media>"
+
+#: C/what-can-do.page:7(info/desc)
+msgid "What can you do with <app>GNOME Hello</app>."
+msgstr "Ce que vous pouvez faire avec <app>GNOME Hello</app>."
+
+#: C/what-can-do.page:21(page/title)
+msgid "What <app>GNOME Hello</app> does"
+msgstr "Ce que <app>GNOME Hello</app> fait"
+
+#: C/what-can-do.page:23(page/p)
+msgid "At the moment <app>GNOME Hello</app> can't do many things."
+msgstr ""
+"À l'heure actuelle, <app>GNOME Hello</app> ne peut pas faire beaucoup de "
+"choses."
+
+#: C/what-can-do.page:26(page/p)
+msgid ""
+"This is just a demonstration on how to install help files and how to use "
+"Mallard, the new syntax for writing GNOME documentation."
+msgstr ""
+"Ce n'est qu'une démonstration sur la façon d'installer les fichiers d'aide "
+"et sur la façon d'utiliser Mallard, la nouvelle syntaxe pour écrire de la "
+"documentation GNOME."
+
+#: C/what-can-do.page:30(page/p)
+msgid ""
+"If you want to learn more about Mallard, see the <link href=\"http://";
+"projectmallard.org/\">Project Mallard</link> home page."
+msgstr ""
+"Si vous voulez en savoir plus au sujet de Mallard, consultez la page "
+"d'accueil du <link href=\"http://projectmallard.org/\";>Projet Mallard</link>."
+
+#: C/legal.xml:4(p/link)
+msgid "Creative Commons Attribution-Share Alike 3.0 United States License"
+msgstr ""
+"Creative Commons Paternité-Partage des Conditions Initiales à l'Identique "
+"3.0 Unported"
+
+#: C/legal.xml:3(license/p)
+msgid "This work is licensed under a <_:link-1/>."
+msgstr "Ce travail est distribué sous licence <_:link-1/>."
+
+#: C/legal.xml:6(license/p)
+msgid ""
+"As a special exception, the copyright holders give you permission to copy, "
+"modify, and distribute the example code contained in this document under the "
+"terms of your choosing, without restriction."
+msgstr ""
+"À titre exceptionnel, les détenteurs des droits vous autorisent à copier, "
+"modifier et distribuer les exemples de code contenus dans ce document selon "
+"vos propres termes, sans restriction."
diff --git a/stats/tests/help_mallard/meson.build b/stats/tests/git/testmodule/help_mallard/meson.build
similarity index 100%
rename from stats/tests/help_mallard/meson.build
rename to stats/tests/git/testmodule/help_mallard/meson.build
diff --git a/stats/tests/tests.py b/stats/tests/tests.py
index 9776985..61fa27b 100644
--- a/stats/tests/tests.py
+++ b/stats/tests/tests.py
@@ -12,6 +12,7 @@ from django.core import mail
 from django.core.exceptions import ValidationError
 from django.urls import reverse
 from django.test import TestCase
+from django.test.utils import override_settings
 
 from stats.models import (
     Module, Domain, Branch, Release, CategoryName, Statistics, FakeLangStatistics,
@@ -545,10 +546,22 @@ class FigureTests(TestCase):
         self.assertTrue(errs[0][1].startswith("Figures should not be copied"))
 
 
+@override_settings(SCRATCHDIR=str(Path(__file__).parent))
 class UtilsTests(TestCase):
-    def test_read_file_variable(self):
-        base_path = Path(__file__).parent / "help_docbook"
-        makefile = utils.MakefileWrapper.find_file([base_path])
+    @classmethod
+    def setUpTestData(self):
+        Branch.checkout_on_creation = False
+        Branch.checkout = mocked_checkout
+        self.mod = Module.objects.create(name="testmodule", vcs_type='git')
+        self.branch = Branch(module=self.mod, name="master")
+        self.branch.save(update_statistics=False)
+
+    def test_read_makefile_variable(self):
+        domain = Domain.objects.create(
+            module=self.mod, name='help', dtype='doc', directory='help_docbook'
+        )
+        makefile = utils.MakefileWrapper.find_file(
+            self.branch, [self.branch.domain_path(domain)])
         var_content = makefile.read_variable("DOC_INCLUDES")
         self.assertEqual(var_content.split(), ['rnusers.xml', 'rnlookingforward.xml', '$(NULL)'])
 
@@ -556,8 +569,11 @@ class UtilsTests(TestCase):
         self.assertEqual(var_content.split(), ['rnusers.xml', 'rnlookingforward.xml'])
 
     def test_read_meson_variables(self):
-        path = Path(__file__).parent / "help_mallard"
-        meson_file = utils.MakefileWrapper.find_file([path], file_name='meson.build')
+        domain = Domain.objects.create(
+            module=self.mod, name='help', dtype='doc', directory='help_mallard'
+        )
+        meson_file = utils.MakefileWrapper.find_file(
+            self.branch, [self.branch.domain_path(domain)], file_name='meson.build')
         self.assertEqual(meson_file.read_variable('yelp.languages'), ['es', 'fr'])
         self.assertEqual(
             meson_file.read_variable('yelp.sources'),
@@ -565,13 +581,16 @@ class UtilsTests(TestCase):
         )
         # UI meson file
         path = Path(__file__).parent / "meson-ui.build"
-        meson_file = utils.MesonfileWrapper(path)
+        meson_file = utils.MesonfileWrapper(self.branch, path)
         self.assertEqual(meson_file.read_variable('gettext.preset'), 'glib')
         self.assertEqual(meson_file.read_variable('gettext.args'), ['--keyword=Description'])
 
     def test_read_cmake_variables(self):
-        path = Path(__file__).parent / "help_mallard"
-        cmake_file = utils.MakefileWrapper.find_file([path], file_name='CMakeLists.txt')
+        domain = Domain.objects.create(
+            module=self.mod, name='help', dtype='doc', directory='help_mallard'
+        )
+        cmake_file = utils.MakefileWrapper.find_file(
+            self.branch, [self.branch.domain_path(domain)], file_name='CMakeLists.txt')
         self.assertEqual(
             cmake_file.read_variable('HELP_FILES').split(),
             ['index.page', 'what-is.page', 'legal.xml']
@@ -581,13 +600,16 @@ class UtilsTests(TestCase):
         """
         Test Docbook-style help
         """
-        help_path = Path(__file__).parent / "help_docbook"
-        self.addCleanup(os.remove, str(help_path / 'C' / "release-notes.pot"))
-        potfile, errs, doc_format = utils.generate_doc_pot_file(help_path, 'release-notes', 'release-notes')
+        domain = Domain.objects.create(
+            module=self.mod, name='release-notes', dtype='doc', directory='help_docbook'
+        )
+        potfile, errs, doc_format = utils.generate_doc_pot_file(self.branch, domain)
+        self.assertEqual(errs, [])
         self.assertEqual(doc_format.tool, 'xml2po')
         self.assertEqual(doc_format.format, 'docbook')
-        pot_path = help_path / "C" / "release-notes.pot"
+        pot_path = self.branch.domain_path(domain) / "C" / "release-notes.pot"
         self.assertTrue(pot_path.exists())
+        self.addCleanup(os.remove, str(pot_path))
         self.assertIn('#: C/rnlookingforward.xml:11(para)', pot_path.read_text())
         res = utils.get_fig_stats(pot_path, doc_format=doc_format)
         self.assertEqual(len(res), 1)
@@ -597,13 +619,15 @@ class UtilsTests(TestCase):
         """
         Test Mallard-style help (with itstool)
         """
-        help_path = Path(__file__).parent / "help_mallard"
-        self.addCleanup(os.remove, str(help_path / 'C' / 'gnome-hello.pot'))
-        potfile, errs, doc_format = utils.generate_doc_pot_file(help_path, 'gnome-hello', 'gnome-hello')
+        domain = Domain.objects.create(
+            module=self.mod, name='release-notes', dtype='doc', directory='help_mallard'
+        )
+        potfile, errs, doc_format = utils.generate_doc_pot_file(self.branch, domain)
         self.assertEqual(errs, [])
-        self.assertEqual(potfile, help_path / 'C' / 'gnome-hello.pot')
+        self.assertEqual(potfile.name, 'release-notes.pot')
         self.assertEqual(doc_format.tool, 'itstool')
         self.assertEqual(doc_format.format, 'mallard')
+        self.addCleanup(os.remove, str(potfile))
         self.assertIn('#: C/what-is.page:7', potfile.read_text())
         res = utils.get_fig_stats(potfile, doc_format=doc_format)
         self.assertEqual(len(res), 1)
diff --git a/stats/utils.py b/stats/utils.py
index e3cfdf4..97f7758 100644
--- a/stats/utils.py
+++ b/stats/utils.py
@@ -138,7 +138,7 @@ class MakefileWrapper:
     default_makefiles = ['Makefile.am', 'meson.build', 'CMakeLists.txt']
 
     @classmethod
-    def find_file(cls, vcs_paths, file_name=None):
+    def find_file(cls, branch, vcs_paths, file_name=None):
         """Return the first makefile found as a MakefileWrapper instance, or None."""
         names = [file_name] if file_name is not None else cls.default_makefiles
         for path in vcs_paths:
@@ -146,13 +146,14 @@ class MakefileWrapper:
                 file_path = path / file_name
                 if file_path.exists():
                     if file_name == 'meson.build':
-                        return MesonfileWrapper(file_path)
+                        return MesonfileWrapper(branch, file_path)
                     elif file_name == 'CMakeLists.txt':
-                        return CMakefileWrapper(file_path)
+                        return CMakefileWrapper(branch, file_path)
                     else:
-                        return MakefileWrapper(file_path)
+                        return MakefileWrapper(branch, file_path)
 
-    def __init__(self, path):
+    def __init__(self, branch, path):
+        self.branch = branch
         self.path = path
 
     @cached_property
@@ -414,7 +415,7 @@ def generate_doc_pot_file(branch, domain):
     errors = []
     vcs_path = branch.domain_path(domain)
     moduleid = branch.module.name
-    makefile = MakefileWrapper.find_file([vcs_path])
+    makefile = MakefileWrapper.find_file(branch, [vcs_path])
     if makefile is None:
         errors.append(
             ("error", ugettext_noop("Unable to find a makefile for module %s") % moduleid)
@@ -608,7 +609,7 @@ def get_doc_linguas(branch, subdir):
     """Get language list in one Makefile.am (either path) """
     linguas = None
     po_path = branch.co_path / subdir
-    linguas_file = MakefileWrapper.find_file([po_path, branch.co_path])
+    linguas_file = MakefileWrapper.find_file(branch, [po_path, branch.co_path])
     if linguas_file:
         linguas = linguas_file.read_variable("DOC_LINGUAS", "HELP_LINGUAS", "gettext.languages")
     if linguas is None:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]