Skip to content

Commit

Permalink
Preserve taint/ subdirectory structure when building pyre-check w…
Browse files Browse the repository at this point in the history
…heel

Summary:
Our open source builds have been broken for a long time, because the taint.config in the `taint` data folder shipped with our wheel has just been empty. It seems like the root cause was that all of our taint from various folders such as `taint/core_privacy_security`, `taint/common` was being copied into the wheel under `pyre_check/taint` rather than keeping the subdirectory structure, meaning that the empty taint.config under `common/` is being written to the `pyre_check/taint` folder in the wheel, overwriting the `core_privacy_security/taint.config` file at times, because files from both subfolders are being copied to the same destination location in the wheel.

Since we need to release a new open source package due to recent GitHub issues asking about features we have long implemented (but have not pushed out), let's fix the script so we can make non-broken builds again.

Reviewed By: 0xedward

Differential Revision: D33247107

fbshipit-source-id: 67288937d4e640092c9b650af9f77184a08d5f27
  • Loading branch information
onionymous authored and facebook-github-bot committed Dec 21, 2021
1 parent fc6bcaf commit 8c2b241
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions scripts/pypi/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,27 @@ def find_taint_stubs() -> List[Tuple[str, List[str]]]:
taint_stubs = []
for path in Path(os.path.join(os.getcwd(), "taint")).iterdir():
if path.is_dir():
_, temporary_stubs = get_data_files(directory=str(path), extension_glob="*")
taint_stubs += temporary_stubs
_, third_party_taint_stubs = get_data_files(
relative_directory, temporary_stubs = get_data_files(
directory=str(path), extension_glob="*"
)
if temporary_stubs:
taint_stubs.append(
(
os.path.join("lib", "pyre_check", relative_directory),
temporary_stubs,
)
)
relative_directory, third_party_taint_stubs = get_data_files(
directory=os.path.join(os.getcwd(), "third_party_taint"), extension_glob="*"
)
taint_stubs += third_party_taint_stubs
if not taint_stubs:
return []
return [(os.path.join("lib", "pyre_check", "taint"), taint_stubs)]
if third_party_taint_stubs:
taint_stubs.append(
(
os.path.join("lib", "pyre_check", relative_directory),
third_party_taint_stubs,
)
)
return taint_stubs


def run(
Expand Down

0 comments on commit 8c2b241

Please sign in to comment.