Skip to content

Commit

Permalink
Do not default to __file__ root (#678)
Browse files Browse the repository at this point in the history
  • Loading branch information
grasskin authored Aug 8, 2023
1 parent 1f6dede commit db9d734
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pip_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,14 @@ def ignore_files(_, filenames):
return [f for f in filenames if f.endswith("_test.py")]


def build():
def build(root_path):
if os.path.exists(build_directory):
raise ValueError(f"Directory already exists: {build_directory}")

whl_path = None
try:
# Copy sources (`keras_core/` directory and setup files) to build
# directory
root_path = pathlib.Path(__file__).parent.resolve()
os.chdir(root_path)
os.mkdir(build_directory)
shutil.copytree(
Expand Down Expand Up @@ -181,6 +180,7 @@ def install_whl(whl_fpath):
help="Whether to install the generated wheel file.",
)
args = parser.parse_args()
whl_path = build()
root_path = pathlib.Path(__file__).parent.resolve()
whl_path = build(root_path)
if whl_path and args.install:
install_whl(whl_path)

0 comments on commit db9d734

Please sign in to comment.