From c7d4362533d503c58474e036b6888827700ba821 Mon Sep 17 00:00:00 2001 From: Maggie Moss Date: Thu, 19 Dec 2019 10:39:16 -0800 Subject: [PATCH] Add sapp to pyre open source release (2/n) Reviewed By: dkgi Differential Revision: D19168340 fbshipit-source-id: fee2f07806c75acb3c269b80b573e3bf9184091a --- scripts/build-pypi-package.sh | 13 +++++++++++++ scripts/setup.py | 7 +++++++ 2 files changed, 20 insertions(+) diff --git a/scripts/build-pypi-package.sh b/scripts/build-pypi-package.sh index 060d059a80d..7861c12c90b 100755 --- a/scripts/build-pypi-package.sh +++ b/scripts/build-pypi-package.sh @@ -82,6 +82,14 @@ done # Create build tree. SCRIPTS_DIRECTORY="$(dirname "$("${READLINK}" -f "$0")")" +# sapp directory is either beside or inside pyre-check directory +SAPP_DIRECTORY="${SCRIPTS_DIRECTORY}/../tools/sapp/" +if [[ ! -d "${SAPP_DIRECTORY}" ]]; then + SAPP_DIRECTORY="${SCRIPTS_DIRECTORY}/../../sapp/" +fi + + + cd "${SCRIPTS_DIRECTORY}/" BUILD_ROOT="$(mktemp -d)" cd "${BUILD_ROOT}" @@ -105,6 +113,11 @@ rsync -avm --filter='+ */' --filter='-! *.pysa' "${PYRE_ROOT}/stubs/taint" "${BU rsync -avm --filter='+ */' --filter='-! *.pysa' "${PYRE_ROOT}/stubs/third_party_taint" "${BUILD_ROOT}/" cp "${PYRE_ROOT}/stubs/taint/taint.config" "${BUILD_ROOT}/taint/taint.config" +# copy *.py and requirements.txt files from sapp, exclude everything else +rsync -avm --filter='- tests/' --filter='+ */' --filter='+ *.py' \ + --filter='+ *requirements.json' --filter='- *' "${SAPP_DIRECTORY}" \ + "${BUILD_ROOT}/${MODULE_NAME}/tools/sapp" + # Patch version number. sed -i -e "/__version__/s/= \".*\"/= \"${PACKAGE_VERSION}\"/" "${BUILD_ROOT}/${MODULE_NAME}/client/version.py" diff --git a/scripts/setup.py b/scripts/setup.py index 543c799523b..ad1710d9440 100644 --- a/scripts/setup.py +++ b/scripts/setup.py @@ -1,4 +1,5 @@ import glob +import json import os import sys from typing import List, Tuple @@ -54,6 +55,10 @@ def find_taint_stubs(): with open("README.md") as f: long_description = f.read() +with open( + os.path.join("pyre_check", "tools", "sapp", "requirements.json") +) as json_file: + extra_requirements = json.load(json_file) PYRE_EMAIL = "pyre@fb.com" AUTHOR = "Facebook" @@ -89,10 +94,12 @@ def find_taint_stubs(): data_files=[("bin", ["bin/pyre.bin"])] + find_typeshed_files() + find_taint_stubs(), python_requires=">=3.5", install_requires=["pywatchman", "psutil", "libcst", "pyre_extensions"], + extras_require=extra_requirements, entry_points={ "console_scripts": [ "pyre = pyre_check.client.pyre:main", "pyre-upgrade = pyre_check.tools.upgrade.upgrade:main", + "sapp = pyre_check.tools.sapp.sapp.cli:cli [sapp]", ] }, )