Skip to content
This repository has been archived by the owner on Mar 18, 2022. It is now read-only.

Add new option to allow override pdflatex binary #18

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions readthedocs_build/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ def validate(self):
self.validate_requirements_file()
self.validate_conf_file()

self.validate_pdflatex()

def validate_output_base(self):
assert 'output_base' in self.env_config, (
'"output_base" required in "env_config"')
Expand Down Expand Up @@ -291,6 +293,13 @@ def validate_conda(self):

self['conda'] = conda

def validate_pdflatex(self):
if 'pdflatex' not in self.raw_config:
self['pdflatex'] = validate_string('pdflatex')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be no need to validate this string

else:
with self.catch_validation_error('pdflatex'):
self['pdflatex'] = validate_string(self.raw_config['pdflatex'])

def validate_requirements_file(self):
if 'requirements_file' not in self.raw_config:
return None
Expand Down
19 changes: 19 additions & 0 deletions readthedocs_build/config/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,25 @@ def it_uses_validate_string(validate_string):
validate_string.assert_any_call('tests')


def describe_validate_pdflatex():
def it_defaults_to_pdflatex():
build = get_build_config({'python': {}})
build.validate_pdflatex()
assert build['pdflatex'] == 'pdflatex'

def it_validates_is_a_string():
build = get_build_config({'pdflatex': ['invalid']})
with raises(InvalidConfig) as excinfo:
build.validate_pdflatex()
assert excinfo.value.key == 'pdflatex'
assert excinfo.value.code == INVALID_STRING

def it_gets_set_correctly():
build = get_build_config({'pdflatex': 'xelatex'})
build.validate_pdflatex()
assert build['pdflatex'] == 'xelatex'


def describe_validate_use_system_site_packages():
def it_defaults_to_false():
build = get_build_config({'python': {}})
Expand Down