Skip to content

Commit 2c11634

Browse files
committed
A few more simplifications
1 parent c668376 commit 2c11634

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

pip_build.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,20 +63,21 @@ def export_version_string(version, is_nightly=False):
6363
)
6464
f.write(setup_contents)
6565

66-
# Make sure to export the __version__ string
66+
# Overwrite the version string with our package version.
6767
with open(os.path.join(package, "src", "version_utils.py")) as f:
68-
version_contents = list(f.readlines())
68+
version_contents = f.readlines()
6969
with open(os.path.join(package, "src", "version_utils.py"), "w") as f:
7070
for line in version_contents:
7171
if line.startswith("__version__"):
72-
f.write(f'__version__ = "{version}"')
72+
f.write(f'__version__ = "{version}"\n')
7373
else:
7474
f.write(line)
75+
# Make sure to export the __version__ string.
7576
with open(os.path.join(package, "__init__.py")) as f:
7677
init_contents = f.read()
7778
with open(os.path.join(package, "__init__.py"), "w") as f:
78-
f.write(init_contents + "\n\n")
79-
f.write("from keras_nlp.src import __version__\n")
79+
f.write(init_contents)
80+
f.write("from keras_nlp.src.version_utils import __version__\n")
8081

8182

8283
def build(root_path, is_nightly=False):

0 commit comments

Comments
 (0)