Skip to content

Commit

Permalink
[py] Fix how version numbers are handled
Browse files Browse the repository at this point in the history
  • Loading branch information
shs96c committed Mar 10, 2024
1 parent d266777 commit d073e59
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 9 deletions.
20 changes: 16 additions & 4 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -624,11 +624,22 @@ namespace :py do
bump_nightly = arguments[:version] === 'nightly'
old_version = python_version
new_version = nil
if bump_nightly && old_version.include?('nightly')
new_version = old_version.gsub('nightly', "#{Time.now.strftime("%Y%m%d%H%M")}")

# There are three cases we want to deal with:
# 1. Switching from a release build to a nightly one
# 2. Updating a nightly build for the next nightly build
# 3. Switching from nightlies to a release build.
# According to PEP440, the way to indicate a nightly build is `M.m.v.devN`
# Where `N` is sorted numerically. That means we can create the dev
# version number from today's date.

if bump_nightly && old_version.include?('.dev')
new_version = old_version.gsub(/\d+$/, "#{Time.now.strftime("%Y%m%d%H%M")}")
elsif bump_nightly
new_version = old_version + ".dev#{Time.now.strftime("%Y%m%d%H%M")}"
else
new_version = updated_version(old_version, arguments[:version])
new_version += '.nightly' unless old_version.include?('nightly')
new_version = updated_version(old_version.gsub(/\.dev\d+$/, ''), arguments[:version])
puts "Calculated new version to be #{new_version}"
end

['py/setup.py',
Expand Down Expand Up @@ -1154,6 +1165,7 @@ task :create_release_notes do
end

def updated_version(current, desired = nil)
puts "Calculating "
version = desired ? desired.split('.') : current.split(/\.|-/)
if desired
# Allows user to pass in only major/minor versions
Expand Down
2 changes: 1 addition & 1 deletion py/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ compile_pip_requirements(
],
)

SE_VERSION = "4.19.0.nightly"
SE_VERSION = "4.19.0.dev202403101143"

BROWSER_VERSIONS = [
"v85",
Expand Down
2 changes: 1 addition & 1 deletion py/docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
# The short X.Y version.
version = '4.19'
# The full version, including alpha/beta/rc tags.
release = '4.19.0.nightly'
release = '4.19.0.dev202403101143'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
2 changes: 1 addition & 1 deletion py/selenium/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
# under the License.


__version__ = "4.19.0.nightly"
__version__ = "4.19.0.dev202403101143"
2 changes: 1 addition & 1 deletion py/selenium/webdriver/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
from .wpewebkit.service import Service as WPEWebKitService # noqa
from .wpewebkit.webdriver import WebDriver as WPEWebKit # noqa

__version__ = "4.19.0.nightly"
__version__ = "4.19.0.dev202403101143"

# We need an explicit __all__ because the above won't otherwise be exported.
__all__ = [
Expand Down
2 changes: 1 addition & 1 deletion py/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
setup_args = {
'cmdclass': {'install': install},
'name': 'selenium',
'version': "4.19.0.nightly",
'version': "4.19.0.dev202403101143",
'license': 'Apache 2.0',
'description': 'Python bindings for Selenium',
'long_description': open(join(abspath(dirname(__file__)), "README.rst")).read(),
Expand Down

0 comments on commit d073e59

Please sign in to comment.