Fix possible importing errors in build_libtorch.py (#15471)
authorDerek Kim <bluewhale8202@gmail.com>
Thu, 17 Jan 2019 07:52:37 +0000 (23:52 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Thu, 17 Jan 2019 07:55:57 +0000 (23:55 -0800)
commitec8b1c94a9531fd2d2d78153774300b625a5c712
treee8df852b96673b0f13ba076cd0f16fbcfa96ea77
parentfcb4b4f00211bf736ef3af2f9b6526cc1a2c4633
Fix possible importing errors in build_libtorch.py (#15471)

Summary:
1. I fixed the importing process, which had some problems
    -  **I think `setup_helpers` should not be imported as the top level module. It can lead to many future errors. For example, what if `setup_helpers` imports another module from the upper level?** So we need to change it.
    - The code is not consistent with other modules in `tools` package. For example, other
    modules in the package imports `from tools.setuptools...` not `from setuptools...`.
    - **It should be able to run with `python -m tools.build_libtorch` command**  because this module is a part of the tools package. Currently, you cannot do that and I think it's simply wrong.

~~2. I Added platform specific warning messages.
    - I constantly forgot that I needed to define some environment variables in advance specific to my platform to build libtorch, especially when I'm working at a non pytorch root directory. So I thought adding warnings for common options would be helpful .~~

~~3. Made the build output path configurable. And a few other changes.~~

orionr  ebetica
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15471

Differential Revision: D13709607

Pulled By: ezyang

fbshipit-source-id: 950d5727aa09f857d973538c50b1ab169d88da38
docs/libtorch.rst
tools/build_libtorch.py