@@ -46,7 +46,7 @@ def file_name_is_cmake_file(file_name):
4646
4747
4848class ChangeStatus (object ):
49- """ Indicates the nature of changes that happened while updating
49+ """Indicates the nature of changes that happened while updating
5050 the source directory. There are two broad uses:
5151 * When extracting archives for third party software we want to
5252 know that we did something (eg: we either extracted code or
@@ -59,9 +59,9 @@ class ChangeStatus(object):
5959 """
6060
6161 def __init__ (self , all_changed = False ):
62- """ Construct a ChangeStatus object. The default is to create
62+ """Construct a ChangeStatus object. The default is to create
6363 a status that indicates no changes, but passing all_changed=True
64- will create one that indicates that everything changed """
64+ will create one that indicates that everything changed"""
6565 if all_changed :
6666 self .source_files = 1
6767 self .make_files = 1
@@ -70,7 +70,7 @@ def __init__(self, all_changed=False):
7070 self .make_files = 0
7171
7272 def record_change (self , file_name ):
73- """ Used by the shipit fetcher to record changes as it updates
73+ """Used by the shipit fetcher to record changes as it updates
7474 files in the destination. If the file name might be one used
7575 in the cmake build system that we use for 1st party code, then
7676 record that as a "make file" change. We could broaden this
@@ -79,7 +79,7 @@ def record_change(self, file_name):
7979 If the file isn't a build file and is under the `fbcode_builder`
8080 dir then we don't class that as an interesting change that we
8181 might need to rebuild, so we ignore it.
82- Otherwise we record the file as a source file change. """
82+ Otherwise we record the file as a source file change."""
8383
8484 file_name = file_name .lower ()
8585 if file_name_is_cmake_file (file_name ):
@@ -90,41 +90,41 @@ def record_change(self, file_name):
9090 self .source_files += 1
9191
9292 def sources_changed (self ):
93- """ Returns true if any source files were changed during
93+ """Returns true if any source files were changed during
9494 an update operation. This will typically be used to decide
9595 that the build system to be run on the source dir in an
96- incremental mode """
96+ incremental mode"""
9797 return self .source_files > 0
9898
9999 def build_changed (self ):
100- """ Returns true if any build files were changed during
100+ """Returns true if any build files were changed during
101101 an update operation. This will typically be used to decidfe
102102 that the build system should be reconfigured and re-run
103- as a full build """
103+ as a full build"""
104104 return self .make_files > 0
105105
106106
107107class Fetcher (object ):
108- """ The Fetcher is responsible for fetching and extracting the
108+ """The Fetcher is responsible for fetching and extracting the
109109 sources for project. The Fetcher instance defines where the
110110 extracted data resides and reports this to the consumer via
111- its `get_src_dir` method. """
111+ its `get_src_dir` method."""
112112
113113 def update (self ):
114- """ Brings the src dir up to date, ideally minimizing
114+ """Brings the src dir up to date, ideally minimizing
115115 changes so that a subsequent build doesn't over-build.
116116 Returns a ChangeStatus object that helps the caller to
117117 understand the nature of the changes required during
118- the update. """
118+ the update."""
119119 return ChangeStatus ()
120120
121121 def clean (self ):
122- """ Reverts any changes that might have been made to
123- the src dir """
122+ """Reverts any changes that might have been made to
123+ the src dir"""
124124 pass
125125
126126 def hash (self ):
127- """ Returns a hash that identifies the version of the code in the
127+ """Returns a hash that identifies the version of the code in the
128128 working copy. For a git repo this is commit hash for the working
129129 copy. For other Fetchers this should relate to the version of
130130 the code in the src dir. The intent is that if a manifest
@@ -137,17 +137,17 @@ def hash(self):
137137 pass
138138
139139 def get_src_dir (self ):
140- """ Returns the source directory that the project was
141- extracted into """
140+ """Returns the source directory that the project was
141+ extracted into"""
142142 pass
143143
144144
145145class LocalDirFetcher (object ):
146- """ This class exists to override the normal fetching behavior, and
146+ """This class exists to override the normal fetching behavior, and
147147 use an explicit user-specified directory for the project sources.
148148
149149 This fetcher cannot update or track changes. It always reports that the
150- project has changed, forcing it to always be built. """
150+ project has changed, forcing it to always be built."""
151151
152152 def __init__ (self , path ):
153153 self .path = os .path .realpath (path )
@@ -337,9 +337,9 @@ def does_file_need_update(src_name, src_st, dest_name):
337337
338338
339339def copy_if_different (src_name , dest_name ):
340- """ Copy src_name -> dest_name, but only touch dest_name
340+ """Copy src_name -> dest_name, but only touch dest_name
341341 if src_name is different from dest_name, making this a
342- more build system friendly way to copy. """
342+ more build system friendly way to copy."""
343343 src_st = os .lstat (src_name )
344344 if not does_file_need_update (src_name , src_st , dest_name ):
345345 return False
@@ -379,19 +379,19 @@ def __init__(self):
379379 self .exclusion = []
380380
381381 def add_mapping (self , fbsource_dir , target_dir ):
382- """ Add a posix path or pattern. We cannot normpath the input
382+ """Add a posix path or pattern. We cannot normpath the input
383383 here because that would change the paths from posix to windows
384- form and break the logic throughout this class. """
384+ form and break the logic throughout this class."""
385385 self .roots .append (fbsource_dir )
386386 self .mapping .append ((fbsource_dir , target_dir ))
387387
388388 def add_exclusion (self , pattern ):
389389 self .exclusion .append (re .compile (pattern ))
390390
391391 def _minimize_roots (self ):
392- """ compute the de-duplicated set of roots within fbsource.
392+ """compute the de-duplicated set of roots within fbsource.
393393 We take the shortest common directory prefix to make this
394- determination """
394+ determination"""
395395 self .roots .sort (key = len )
396396 minimized = []
397397
@@ -496,10 +496,10 @@ class FbsourceRepoData(NamedTuple):
496496
497497
498498def get_fbsource_repo_data (build_options ):
499- """ Returns the commit metadata for the fbsource repo.
499+ """Returns the commit metadata for the fbsource repo.
500500 Since we may have multiple first party projects to
501501 hash, and because we don't mutate the repo, we cache
502- this hash in a global. """
502+ this hash in a global."""
503503 cached_data = FBSOURCE_REPO_DATA .get (build_options .fbsource_dir )
504504 if cached_data :
505505 return cached_data
0 commit comments