@@ -157,7 +157,7 @@ class BuildConfigBase:
157
157
158
158
def __init__ (self , env_config , raw_config , source_file ):
159
159
self .env_config = env_config
160
- self .raw_config = copy .deepcopy (raw_config )
160
+ self ._raw_config = copy .deepcopy (raw_config )
161
161
self .source_file = source_file
162
162
if os .path .isdir (self .source_file ):
163
163
self .base_path = self .source_file
@@ -224,13 +224,13 @@ def pop(self, name, container, default, raise_ex):
224
224
225
225
def pop_config (self , key , default = None , raise_ex = False ):
226
226
"""
227
- Search and pop a key (recursively) from `self.raw_config `.
227
+ Search and pop a key (recursively) from `self._raw_config `.
228
228
229
229
:param key: the key name in a dotted form (``key.innerkey``)
230
230
:param default: Optionally, it can receive a default value
231
231
:param raise_ex: If True, raises an exception when the key is not found
232
232
"""
233
- return self .pop (key .split ('.' ), self .raw_config , default , raise_ex )
233
+ return self .pop (key .split ('.' ), self ._raw_config , default , raise_ex )
234
234
235
235
def validate (self ):
236
236
raise NotImplementedError ()
@@ -382,8 +382,8 @@ def validate_build(self):
382
382
build = {'image' : settings .DOCKER_IMAGE }
383
383
384
384
# User specified
385
- if 'build' in self .raw_config :
386
- _build = self .raw_config ['build' ]
385
+ if 'build' in self ._raw_config :
386
+ _build = self ._raw_config ['build' ]
387
387
if 'image' in _build :
388
388
with self .catch_validation_error ('build' ):
389
389
build ['image' ] = validate_choice (
@@ -419,8 +419,8 @@ def validate_python(self):
419
419
'version' : version ,
420
420
}
421
421
422
- if 'python' in self .raw_config :
423
- raw_python = self .raw_config ['python' ]
422
+ if 'python' in self ._raw_config :
423
+ raw_python = self ._raw_config ['python' ]
424
424
if not isinstance (raw_python , dict ):
425
425
self .error (
426
426
'python' ,
@@ -491,8 +491,8 @@ def validate_conda(self):
491
491
"""Validates the ``conda`` key."""
492
492
conda = {}
493
493
494
- if 'conda' in self .raw_config :
495
- raw_conda = self .raw_config ['conda' ]
494
+ if 'conda' in self ._raw_config :
495
+ raw_conda = self ._raw_config ['conda' ]
496
496
with self .catch_validation_error ('conda' ):
497
497
validate_dict (raw_conda )
498
498
with self .catch_validation_error ('conda.file' ):
@@ -508,10 +508,10 @@ def validate_conda(self):
508
508
509
509
def validate_requirements_file (self ):
510
510
"""Validates that the requirements file exists."""
511
- if 'requirements_file' not in self .raw_config :
511
+ if 'requirements_file' not in self ._raw_config :
512
512
requirements_file = self .defaults .get ('requirements_file' )
513
513
else :
514
- requirements_file = self .raw_config ['requirements_file' ]
514
+ requirements_file = self ._raw_config ['requirements_file' ]
515
515
if not requirements_file :
516
516
return None
517
517
with self .catch_validation_error ('requirements_file' ):
@@ -523,7 +523,7 @@ def validate_requirements_file(self):
523
523
524
524
def validate_formats (self ):
525
525
"""Validates that formats contains only valid formats."""
526
- formats = self .raw_config .get ('formats' )
526
+ formats = self ._raw_config .get ('formats' )
527
527
if formats is None :
528
528
return self .defaults .get ('formats' , [])
529
529
if formats == ['none' ]:
@@ -674,7 +674,7 @@ def validate_formats(self):
674
674
675
675
def validate_conda (self ):
676
676
"""Validates the conda key."""
677
- raw_conda = self .raw_config .get ('conda' )
677
+ raw_conda = self ._raw_config .get ('conda' )
678
678
if raw_conda is None :
679
679
return None
680
680
@@ -693,7 +693,7 @@ def validate_build(self):
693
693
694
694
It prioritizes the value from the default image if exists.
695
695
"""
696
- raw_build = self .raw_config .get ('build' , {})
696
+ raw_build = self ._raw_config .get ('build' , {})
697
697
with self .catch_validation_error ('build' ):
698
698
validate_dict (raw_build )
699
699
build = {}
@@ -729,7 +729,7 @@ def validate_python(self):
729
729
- ``version`` can be a string or number type.
730
730
- ``extra_requirements`` needs to be used with ``install: 'pip'``.
731
731
"""
732
- raw_python = self .raw_config .get ('python' , {})
732
+ raw_python = self ._raw_config .get ('python' , {})
733
733
with self .catch_validation_error ('python' ):
734
734
validate_dict (raw_python )
735
735
@@ -750,17 +750,17 @@ def validate_python(self):
750
750
)
751
751
752
752
with self .catch_validation_error ('python.install' ):
753
- raw_install = self .raw_config .get ('python' , {}).get ('install' , [])
753
+ raw_install = self ._raw_config .get ('python' , {}).get ('install' , [])
754
754
validate_list (raw_install )
755
755
if raw_install :
756
756
# Transform to a dict, so it's easy to validate extra keys.
757
- self .raw_config .setdefault ('python' , {})['install' ] = (
757
+ self ._raw_config .setdefault ('python' , {})['install' ] = (
758
758
list_to_dict (raw_install )
759
759
)
760
760
else :
761
761
self .pop_config ('python.install' )
762
762
763
- raw_install = self .raw_config .get ('python' , {}).get ('install' , [])
763
+ raw_install = self ._raw_config .get ('python' , {}).get ('install' , [])
764
764
python ['install' ] = [
765
765
self .validate_python_install (index )
766
766
for index in range (len (raw_install ))
@@ -783,7 +783,7 @@ def validate_python_install(self, index):
783
783
"""Validates the python.install.{index} key."""
784
784
python_install = {}
785
785
key = 'python.install.{}' .format (index )
786
- raw_install = self .raw_config ['python' ]['install' ][str (index )]
786
+ raw_install = self ._raw_config ['python' ]['install' ][str (index )]
787
787
with self .catch_validation_error (key ):
788
788
validate_dict (raw_install )
789
789
@@ -850,7 +850,7 @@ def validate_doc_types(self):
850
850
avoid innecessary validations.
851
851
"""
852
852
with self .catch_validation_error ('.' ):
853
- if 'sphinx' in self .raw_config and 'mkdocs' in self .raw_config :
853
+ if 'sphinx' in self ._raw_config and 'mkdocs' in self ._raw_config :
854
854
self .error (
855
855
'.' ,
856
856
'You can not have the ``sphinx`` and ``mkdocs`` '
@@ -864,7 +864,7 @@ def validate_mkdocs(self):
864
864
865
865
It makes sure we are using an existing configuration file.
866
866
"""
867
- raw_mkdocs = self .raw_config .get ('mkdocs' )
867
+ raw_mkdocs = self ._raw_config .get ('mkdocs' )
868
868
if raw_mkdocs is None :
869
869
return None
870
870
@@ -894,7 +894,7 @@ def validate_sphinx(self):
894
894
It should be called after ``validate_mkdocs``. That way
895
895
we can default to sphinx if ``mkdocs`` is not given.
896
896
"""
897
- raw_sphinx = self .raw_config .get ('sphinx' )
897
+ raw_sphinx = self ._raw_config .get ('sphinx' )
898
898
if raw_sphinx is None :
899
899
if self .mkdocs is None :
900
900
raw_sphinx = {}
@@ -961,7 +961,7 @@ def validate_submodules(self):
961
961
- We can use the ``ALL`` keyword in include or exlude.
962
962
- We can't exlude and include submodules at the same time.
963
963
"""
964
- raw_submodules = self .raw_config .get ('submodules' , {})
964
+ raw_submodules = self ._raw_config .get ('submodules' , {})
965
965
with self .catch_validation_error ('submodules' ):
966
966
validate_dict (raw_submodules )
967
967
@@ -1009,7 +1009,7 @@ def validate_keys(self):
1009
1009
Checks that we don't have extra keys (invalid ones).
1010
1010
1011
1011
This should be called after all the validations are done and all keys
1012
- are popped from `self.raw_config `.
1012
+ are popped from `self._raw_config `.
1013
1013
"""
1014
1014
msg = (
1015
1015
'Invalid configuration option: {}. '
@@ -1018,7 +1018,7 @@ def validate_keys(self):
1018
1018
# The version key isn't popped, but it's
1019
1019
# validated in `load`.
1020
1020
self .pop_config ('version' , None )
1021
- wrong_key = '.' .join (self ._get_extra_key (self .raw_config ))
1021
+ wrong_key = '.' .join (self ._get_extra_key (self ._raw_config ))
1022
1022
if wrong_key :
1023
1023
self .error (
1024
1024
wrong_key ,
0 commit comments