Skip to content

Commit

Permalink
Fix packaging
Browse files Browse the repository at this point in the history
  • Loading branch information
myleott committed Nov 12, 2020
1 parent c76cb6d commit 42162bd
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def do_setup(package_data):
"tests",
"tests.*",
]
),
) + ["fairseq.model_parallel.megatron.mpu"],
package_data=package_data,
ext_modules=extensions,
test_suite="tests",
Expand Down Expand Up @@ -201,12 +201,15 @@ def get_files(path, relative_to="fairseq"):

try:
# symlink config and examples into fairseq package so package_data accepts them
os.symlink(os.path.join("..", "config"), "fairseq/config")
os.symlink(os.path.join("..", "examples"), "fairseq/examples")
installed = os.path.exists("fairseq/config")
if not installed and "build_ext" not in sys.argv[1:]:
os.symlink(os.path.join("..", "config"), "fairseq/config")
os.symlink(os.path.join("..", "examples"), "fairseq/examples")
package_data = {
"fairseq": get_files("fairseq/config") + get_files("fairseq/examples"),
}
do_setup(package_data)
finally:
os.unlink("fairseq/config")
os.unlink("fairseq/examples")
if not installed and "build_ext" not in sys.argv[1:]:
os.unlink("fairseq/config")
os.unlink("fairseq/examples")

0 comments on commit 42162bd

Please sign in to comment.