Skip to content

Commit

Permalink
Standardize the location of third-party source code (pytorch#2086)
Browse files Browse the repository at this point in the history
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: pytorch#2086

Reviewed By: carolineechen

Differential Revision: D33236927

Pulled By: mthrok

fbshipit-source-id: 2f2aa5f4b386fefb46d7c98f7179c04995219f3c
  • Loading branch information
mthrok authored and facebook-github-bot committed Dec 20, 2021
1 parent f3f23e4 commit 2476dd2
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 20 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .circleci/config.yml.in
Original file line number Diff line number Diff line change
Expand Up @@ -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" }}
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,3 @@ examples/tutorials/_assets
# third parties
third_party/install/
third_party/archives/
third_party/sox/archives/
17 changes: 3 additions & 14 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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():
Expand Down
2 changes: 1 addition & 1 deletion third_party/sox/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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,
Expand Down

0 comments on commit 2476dd2

Please sign in to comment.