Commit 2476dd2d authored by moto's avatar moto Committed by Facebook GitHub Bot
Browse files

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
parent f3f23e42
...@@ -145,8 +145,8 @@ jobs: ...@@ -145,8 +145,8 @@ jobs:
- run: - run:
command: | command: |
mkdir -p third_party/sox/archives/ mkdir -p third_party/archives/
wget --no-clobber --directory-prefix=third_party/sox/archives/ $(awk '/URL /{print $2}' third_party/sox/CMakeLists.txt) wget --no-clobber --directory-prefix=third_party/archives/ $(awk '/URL /{print $2}' third_party/*/CMakeLists.txt)
- save_cache: - save_cache:
key: tp-nix-v2-{{ checksum ".cachekey" }} key: tp-nix-v2-{{ checksum ".cachekey" }}
......
...@@ -145,8 +145,8 @@ jobs: ...@@ -145,8 +145,8 @@ jobs:
{% endraw %} {% endraw %}
- run: - run:
command: | command: |
mkdir -p third_party/sox/archives/ mkdir -p third_party/archives/
wget --no-clobber --directory-prefix=third_party/sox/archives/ $(awk '/URL /{print $2}' third_party/sox/CMakeLists.txt) wget --no-clobber --directory-prefix=third_party/archives/ $(awk '/URL /{print $2}' third_party/*/CMakeLists.txt)
- save_cache: - save_cache:
{% raw %} {% raw %}
key: tp-nix-v2-{{ checksum ".cachekey" }} key: tp-nix-v2-{{ checksum ".cachekey" }}
......
...@@ -128,4 +128,3 @@ examples/tutorials/_assets ...@@ -128,4 +128,3 @@ examples/tutorials/_assets
# third parties # third parties
third_party/install/ third_party/install/
third_party/archives/ third_party/archives/
third_party/sox/archives/
...@@ -103,19 +103,9 @@ def _parse_url(path): ...@@ -103,19 +103,9 @@ def _parse_url(path):
yield url yield url
def _parse_sox_sources(): def _parse_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():
third_party_dir = ROOT_DIR / 'third_party' 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 = third_party_dir / 'archives'
archive_dir.mkdir(exist_ok=True) archive_dir.mkdir(exist_ok=True)
for lib in libs: for lib in libs:
...@@ -136,8 +126,7 @@ def _fetch_third_party_libraries(): ...@@ -136,8 +126,7 @@ def _fetch_third_party_libraries():
if not (ROOT_DIR / 'third_party' / 'kaldi' / 'submodule' / 'CMakeLists.txt').exists(): if not (ROOT_DIR / 'third_party' / 'kaldi' / 'submodule' / 'CMakeLists.txt').exists():
_init_submodule() _init_submodule()
if os.name != 'nt': if os.name != 'nt':
_fetch_archives(_parse_sox_sources()) _fetch_archives(_parse_sources())
_fetch_archives(_parse_kenlm_sources())
def _main(): def _main():
......
include(ExternalProject) include(ExternalProject)
set(INSTALL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../install) 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) 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, # To pass custom environment variables to ExternalProject_Add command,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment