Unverified Commit 2b39f1e8 authored by Nikita Shulga's avatar Nikita Shulga Committed by GitHub
Browse files

Do not build unless setup.py is top-level scope (#2969)

I.e. put all file system altering operations under `if __name__ == "__main__":`
parent 052edcec
......@@ -44,7 +44,6 @@ if os.getenv('BUILD_VERSION'):
version = os.getenv('BUILD_VERSION')
elif sha != 'Unknown':
version += '+' + sha[:7]
print("Building wheel {}-{}".format(package_name, version))
def write_version_file():
......@@ -57,10 +56,6 @@ def write_version_file():
f.write(" cuda = _check_cuda_version()\n")
write_version_file()
readme = open('README.rst').read()
pytorch_dep = 'torch'
if os.getenv('PYTORCH_VERSION'):
pytorch_dep += "==" + os.getenv('PYTORCH_VERSION')
......@@ -397,7 +392,15 @@ class clean(distutils.command.clean.clean):
distutils.command.clean.clean.run(self)
setup(
if __name__ == "__main__":
print("Building wheel {}-{}".format(package_name, version))
write_version_file()
with open('README.rst') as f:
readme = f.read()
setup(
# Metadata
name=package_name,
version=version,
......@@ -423,4 +426,4 @@ setup(
'build_ext': BuildExtension.with_options(no_python_abi_suffix=True),
'clean': clean,
}
)
)
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