From 60f2a320cf0fad7fe2eac023daa8362d19582f96 Mon Sep 17 00:00:00 2001
From: Tristan Van Berkom <tristan.vanberkom@codethink.co.uk>
Date: Fri, 6 Apr 2018 16:07:47 +0900
Subject: [PATCH] _project.py: Assert that the loaded project name is a valid
 symbol name

Fixes issue #339
---
 buildstream/_project.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/buildstream/_project.py b/buildstream/_project.py
index cf3c59fef9..f49d7aa840 100644
--- a/buildstream/_project.py
+++ b/buildstream/_project.py
@@ -256,6 +256,11 @@ class Project():
         # The project name, element path and option declarations
         # are constant and cannot be overridden by option conditional statements
         self.name = _yaml.node_get(config, str, 'name')
+
+        # Validate that project name is a valid symbol name
+        _yaml.assert_symbol_name(_yaml.node_get_provenance(config, 'name'),
+                                 self.name, "project name")
+
         self.element_path = os.path.join(
             self.directory,
             _yaml.node_get(config, str, 'element-path')
-- 
GitLab