@@ -614,6 +614,7 @@ def update_app_instances(self, html=False, localmedia=False, search=False,
614
614
args = [
615
615
self .project .pk ,
616
616
self .version .pk ,
617
+ self .config ,
617
618
],
618
619
kwargs = dict (
619
620
hostname = socket .gethostname (),
@@ -695,10 +696,12 @@ def build_docs_html(self):
695
696
696
697
# Gracefully attempt to move files via task on web workers.
697
698
try :
698
- broadcast (type = 'app' , task = move_files ,
699
- args = [self .version .pk , socket .gethostname ()],
700
- kwargs = dict (html = True )
701
- )
699
+ broadcast (
700
+ type = 'app' ,
701
+ task = move_files ,
702
+ args = [self .version .pk , socket .gethostname (), self .config ],
703
+ kwargs = dict (html = True )
704
+ )
702
705
except socket .error :
703
706
log .exception ('move_files task has failed on socket error.' )
704
707
@@ -710,23 +713,23 @@ def build_docs_localmedia(self):
710
713
return False
711
714
712
715
if self .build_localmedia :
713
- if self .project . is_type_sphinx :
716
+ if self .is_type_sphinx () :
714
717
return self .build_docs_class ('sphinx_singlehtmllocalmedia' )
715
718
return False
716
719
717
720
def build_docs_pdf (self ):
718
721
"""Build PDF docs."""
719
722
if ('pdf' not in self .config .formats or
720
- self .project .slug in HTML_ONLY or
721
- not self .project . is_type_sphinx ):
723
+ self .project .slug in HTML_ONLY or
724
+ not self .is_type_sphinx () ):
722
725
return False
723
726
return self .build_docs_class ('sphinx_pdf' )
724
727
725
728
def build_docs_epub (self ):
726
729
"""Build ePub docs."""
727
730
if ('epub' not in self .config .formats or
728
731
self .project .slug in HTML_ONLY or
729
- not self .project . is_type_sphinx ):
732
+ not self .is_type_sphinx () ):
730
733
return False
731
734
return self .build_docs_class ('sphinx_epub' )
732
735
@@ -750,16 +753,22 @@ def send_notifications(self):
750
753
"""Send notifications on build failure."""
751
754
send_notifications .delay (self .version .pk , build_pk = self .build ['id' ])
752
755
756
+ def is_type_sphinx (self ):
757
+ """Is documentation type Sphinx."""
758
+ return 'sphinx' in self .config .doctype
759
+
753
760
754
761
# Web tasks
755
762
@app .task (queue = 'web' )
756
- def sync_files (project_pk , version_pk , hostname = None , html = False ,
763
+ def sync_files (project_pk , version_pk , config , hostname = None , html = False ,
757
764
localmedia = False , search = False , pdf = False , epub = False ):
758
765
"""
759
766
Sync build artifacts to application instances.
760
767
761
768
This task broadcasts from a build instance on build completion and performs
762
769
synchronization of build artifacts on each application instance.
770
+
771
+ :param config: A `readthedocs.config.BuildConfigBase` object
763
772
"""
764
773
# Clean up unused artifacts
765
774
version = Version .objects .get (pk = version_pk )
@@ -782,6 +791,7 @@ def sync_files(project_pk, version_pk, hostname=None, html=False,
782
791
move_files (
783
792
version_pk ,
784
793
hostname ,
794
+ config ,
785
795
html = html ,
786
796
localmedia = localmedia ,
787
797
search = search ,
@@ -797,13 +807,14 @@ def sync_files(project_pk, version_pk, hostname=None, html=False,
797
807
798
808
799
809
@app .task (queue = 'web' )
800
- def move_files (version_pk , hostname , html = False , localmedia = False , search = False ,
801
- pdf = False , epub = False ):
810
+ def move_files (version_pk , hostname , config , html = False , localmedia = False ,
811
+ search = False , pdf = False , epub = False ):
802
812
"""
803
813
Task to move built documentation to web servers.
804
814
805
815
:param version_pk: Version id to sync files for
806
816
:param hostname: Hostname to sync to
817
+ :param config: A `readthedocs.config.BuildConfigBase` object
807
818
:param html: Sync HTML
808
819
:type html: bool
809
820
:param localmedia: Sync local media files
@@ -827,12 +838,12 @@ def move_files(version_pk, hostname, html=False, localmedia=False, search=False,
827
838
if html :
828
839
from_path = version .project .artifact_path (
829
840
version = version .slug ,
830
- type_ = version . project . documentation_type ,
841
+ type_ = config . doctype ,
831
842
)
832
843
target = version .project .rtd_build_path (version .slug )
833
844
Syncer .copy (from_path , target , host = hostname )
834
845
835
- if 'sphinx' in version . project . documentation_type :
846
+ if 'sphinx' in config . doctype :
836
847
if search :
837
848
from_path = version .project .artifact_path (
838
849
version = version .slug ,
@@ -883,21 +894,21 @@ def move_files(version_pk, hostname, html=False, localmedia=False, search=False,
883
894
884
895
885
896
@app .task (queue = 'web' )
886
- def update_search (version_pk , commit , delete_non_commit_files = True ):
897
+ def update_search (version_pk , commit , config , delete_non_commit_files = True ):
887
898
"""
888
899
Task to update search indexes.
889
900
890
901
:param version_pk: Version id to update
891
902
:param commit: Commit that updated index
903
+ :param config: A `readthedocs.config.BuildConfigBase` object
892
904
:param delete_non_commit_files: Delete files not in commit from index
893
905
"""
894
906
version = Version .objects .get (pk = version_pk )
895
907
896
- if version . project . is_type_sphinx :
908
+ if 'sphinx' in config . doctype :
897
909
page_list = process_all_json_files (version , build_dir = False )
898
910
else :
899
- log .debug ('Unknown documentation type: %s' ,
900
- version .project .documentation_type )
911
+ log .debug ('Unknown documentation type: %s' , config .doctype )
901
912
return
902
913
903
914
log_msg = ' ' .join ([page ['path' ] for page in page_list ])
0 commit comments