# HG changeset patch
# User Vincent Hatakeyama <vincent.hatakeyama@xcg-consulting.fr>
# Date 1643206348 -3600
#      Wed Jan 26 15:12:28 2022 +0100
# Node ID 349a1a9110efb8a0187ad5ce57dcf354bd54d034
# Parent  f5078e31a576bb0d46f49ba0cf4acb5cf43e7995
📝 Use the presence of a Dockerfile as a sign that the current directory is a super project

Avoids starting to create files that are not cleaned up.

diff --git a/NEWS.rst b/NEWS.rst
--- a/NEWS.rst
+++ b/NEWS.rst
@@ -13,6 +13,8 @@
 
 Change isort options to be able to show differences.
 
+Use the presence of a Dockerfile as a sign that the current directory is a super project. Avoids starting to create files by error.
+
 14.0.0
 ------
 
diff --git a/odoo_scripts/docker_build.py b/odoo_scripts/docker_build.py
--- a/odoo_scripts/docker_build.py
+++ b/odoo_scripts/docker_build.py
@@ -95,6 +95,11 @@
     dev = nmspc.dev
     push = nmspc.push
 
+    dockerfile = "Dockerfile"
+    if not os.path.exists(dockerfile):
+        _logger.critical("No dockerfile found")
+        return 1
+
     c = Config()
     registry = c.registry
     project = c.image
@@ -134,7 +139,6 @@
             a = arg.split("=")
             buildargs[a[0]] = a[1]
     _logger.debug("Build args: %s", buildargs)
-    dockerfile = "Dockerfile"
     if dev:
         debug_dockerfile = "Dockerfile.debug"
         call(["cp", dockerfile, debug_dockerfile])
@@ -144,7 +148,7 @@
             myfile.write("RUN DEBIAN_FRONTEND=noninteractive apt-get install -y -qq ")
             if odoo_type in ("odoo11", "odoo13", "odoo15"):
                 myfile.write(
-                    "python3-watchdog python3-ipdb python3-pyinotify " "python3-wheel\n"
+                    "python3-watchdog python3-ipdb python3-pyinotify python3-wheel\n"
                 )
                 # newer setuptools_scm>6 is not compatible with python 3.5 due
                 # to the use of f-strings