Skip to content

Commit 42162bd

Browse files
author
Myle Ott
committed
Fix packaging
1 parent c76cb6d commit 42162bd

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

setup.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def do_setup(package_data):
168168
"tests",
169169
"tests.*",
170170
]
171-
),
171+
) + ["fairseq.model_parallel.megatron.mpu"],
172172
package_data=package_data,
173173
ext_modules=extensions,
174174
test_suite="tests",
@@ -201,12 +201,15 @@ def get_files(path, relative_to="fairseq"):
201201

202202
try:
203203
# symlink config and examples into fairseq package so package_data accepts them
204-
os.symlink(os.path.join("..", "config"), "fairseq/config")
205-
os.symlink(os.path.join("..", "examples"), "fairseq/examples")
204+
installed = os.path.exists("fairseq/config")
205+
if not installed and "build_ext" not in sys.argv[1:]:
206+
os.symlink(os.path.join("..", "config"), "fairseq/config")
207+
os.symlink(os.path.join("..", "examples"), "fairseq/examples")
206208
package_data = {
207209
"fairseq": get_files("fairseq/config") + get_files("fairseq/examples"),
208210
}
209211
do_setup(package_data)
210212
finally:
211-
os.unlink("fairseq/config")
212-
os.unlink("fairseq/examples")
213+
if not installed and "build_ext" not in sys.argv[1:]:
214+
os.unlink("fairseq/config")
215+
os.unlink("fairseq/examples")

0 commit comments

Comments
 (0)