From 2476dd2da27395bfeb7f909492b6f0920cfb6164 Mon Sep 17 00:00:00 2001 From: moto <855818+mthrok@users.noreply.github.com> Date: Mon, 20 Dec 2021 10:43:23 -0800 Subject: [PATCH] Standardize the location of third-party source code (#2086) Summary: Previously sox-related third-party source code was archived at `third_party/sox/archives`. Recently KenLM-related third-party source code was added and they are archived at `third_party/archives`. This PR changes the sox archive location to `third_party/archives`, so that all the archvies are cached at the same location. Pull Request resolved: https://github.com/pytorch/audio/pull/2086 Reviewed By: carolineechen Differential Revision: D33236927 Pulled By: mthrok fbshipit-source-id: 2f2aa5f4b386fefb46d7c98f7179c04995219f3c --- .circleci/config.yml | 4 ++-- .circleci/config.yml.in | 4 ++-- .gitignore | 1 - setup.py | 17 +++-------------- third_party/sox/CMakeLists.txt | 2 +- 5 files changed, 8 insertions(+), 20 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e6d35351a8..2286325042 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -145,8 +145,8 @@ jobs: - run: command: | - mkdir -p third_party/sox/archives/ - wget --no-clobber --directory-prefix=third_party/sox/archives/ $(awk '/URL /{print $2}' third_party/sox/CMakeLists.txt) + mkdir -p third_party/archives/ + wget --no-clobber --directory-prefix=third_party/archives/ $(awk '/URL /{print $2}' third_party/*/CMakeLists.txt) - save_cache: key: tp-nix-v2-{{ checksum ".cachekey" }} diff --git a/.circleci/config.yml.in b/.circleci/config.yml.in index 5c1a770c38..cdc076c4d4 100644 --- a/.circleci/config.yml.in +++ b/.circleci/config.yml.in @@ -145,8 +145,8 @@ jobs: {% endraw %} - run: command: | - mkdir -p third_party/sox/archives/ - wget --no-clobber --directory-prefix=third_party/sox/archives/ $(awk '/URL /{print $2}' third_party/sox/CMakeLists.txt) + mkdir -p third_party/archives/ + wget --no-clobber --directory-prefix=third_party/archives/ $(awk '/URL /{print $2}' third_party/*/CMakeLists.txt) - save_cache: {% raw %} key: tp-nix-v2-{{ checksum ".cachekey" }} diff --git a/.gitignore b/.gitignore index 3d7f0c9e30..248c95b5b9 100644 --- a/.gitignore +++ b/.gitignore @@ -128,4 +128,3 @@ examples/tutorials/_assets # third parties third_party/install/ third_party/archives/ -third_party/sox/archives/ diff --git a/setup.py b/setup.py index cea4ee9b24..324a618a98 100644 --- a/setup.py +++ b/setup.py @@ -103,19 +103,9 @@ def _parse_url(path): yield url -def _parse_sox_sources(): - sox_dir = ROOT_DIR / 'third_party' / 'sox' - cmake_file = sox_dir / 'CMakeLists.txt' - archive_dir = sox_dir / 'archives' - archive_dir.mkdir(exist_ok=True) - for url in _parse_url(cmake_file): - path = archive_dir / os.path.basename(url) - yield path, url - - -def _parse_kenlm_sources(): +def _parse_sources(): third_party_dir = ROOT_DIR / 'third_party' - libs = ['zlib', 'bzip2', 'lzma', 'boost'] + libs = ['zlib', 'bzip2', 'lzma', 'boost', 'sox'] archive_dir = third_party_dir / 'archives' archive_dir.mkdir(exist_ok=True) for lib in libs: @@ -136,8 +126,7 @@ def _fetch_third_party_libraries(): if not (ROOT_DIR / 'third_party' / 'kaldi' / 'submodule' / 'CMakeLists.txt').exists(): _init_submodule() if os.name != 'nt': - _fetch_archives(_parse_sox_sources()) - _fetch_archives(_parse_kenlm_sources()) + _fetch_archives(_parse_sources()) def _main(): diff --git a/third_party/sox/CMakeLists.txt b/third_party/sox/CMakeLists.txt index 124d605e8e..ff35e70bff 100644 --- a/third_party/sox/CMakeLists.txt +++ b/third_party/sox/CMakeLists.txt @@ -1,7 +1,7 @@ include(ExternalProject) set(INSTALL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../install) -set(ARCHIVE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/archives) +set(ARCHIVE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../archives) set(COMMON_ARGS --quiet --disable-shared --enable-static --prefix=${INSTALL_DIR} --with-pic --disable-dependency-tracking --disable-debug --disable-examples --disable-doc) # To pass custom environment variables to ExternalProject_Add command,