Skip to content

Commit

Permalink
Clean up versioning code for nightly builds.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 249226101
  • Loading branch information
TensorFlow Hub Authors authored and andresusanopinto committed May 22, 2019
1 parent 2febdde commit 7156777
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
8 changes: 0 additions & 8 deletions tensorflow_hub/pip_package/build_pip_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,6 @@ function main() {
cp "LICENSE" "${TMPDIR}/LICENSE.txt"
cp -R "${RUNFILES}/tensorflow_hub" "${TMPDIR}"

# If we're dealing with a nightly build we need to make sure that the
# version changes on a daily basis. This hack edits the setup.py file
# accordingly.
if [[ "${PROJECT_NAME}" -eq "tf-hub-nightly" ]]; then
POSTFIX=".dev$(date +%Y%m%d%H%M)"
sed -i -E "s/version=__version__/version=(__version__ + '${POSTFIX}')/" ${TMPDIR}/setup.py
fi

pushd ${TMPDIR}
rm -f MANIFEST

Expand Down
9 changes: 8 additions & 1 deletion tensorflow_hub/pip_package/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from __future__ import division
from __future__ import print_function

from datetime import datetime
from setuptools import find_packages
from setuptools import setup

Expand All @@ -40,9 +41,15 @@
sys.argv.remove('--project_name')
sys.argv.pop(project_name_idx)

# If we're dealing with a nightly build we need to make sure that the
# version changes for every release.
version = __version__
if project_name == 'tf-hub-nightly':
version += '.dev' + datetime.now().strftime('%Y%m%d%H%M')

setup(
name=project_name, # Automatic: tensorflow_hub, etc. Case insensitive.
version=__version__.replace('-', ''),
version=version.replace('-', ''),
description=('TensorFlow Hub is a library to foster the publication, '
'discovery, and consumption of reusable parts of machine '
'learning models.'),
Expand Down

0 comments on commit 7156777

Please sign in to comment.