@@ -76,12 +76,8 @@ def docs(session: nox.Session) -> str:
7676 print ("Unsupported argument to docs" )
7777
7878
79- @nox .session
80- def bump (session : nox .Session ) -> None :
81- """
82- Set to a new version, use -- <version>, otherwise will use the latest version.
83- """
84- parser = argparse .ArgumentParser (description = "Process some integers." )
79+ def _bump (session : nox .Session , name : str , repository : str , script : str , files ) -> None :
80+ parser = argparse .ArgumentParser ()
8581 parser .add_argument (
8682 "--commit" , action = "store_true" , help = "Make a branch and commit."
8783 )
@@ -92,34 +88,45 @@ def bump(session: nox.Session) -> None:
9288
9389 if args .version is None :
9490 session .install ("lastversion" )
95- version = session .run (
96- "lastversion" , "kitware/cmake" , log = False , silent = True
97- ).strip ()
91+ version = session .run ("lastversion" , repository , log = False , silent = True ).strip ()
9892 else :
9993 version = args .version
10094
10195 session .install ("requests" )
10296
10397 extra = ["--quiet" ] if args .commit else []
104- session .run ("python" , "scripts/update_cmake_version.py" , version , * extra )
98+ session .run ("python" , script , version , * extra )
10599
106100 if args .commit :
107- session .run ("git" , "switch" , "-c" , f"update-to-cmake-{ version } " , external = True )
108- files = (
109- "CMakeUrls.cmake" ,
110- "docs/index.rst" ,
111- "README.rst" ,
112- "tests/test_distribution.py" ,
113- "docs/update_cmake_version.rst" ,
114- )
115- session .run (
116- "git" ,
117- "add" ,
118- "-u" ,
119- * files ,
120- external = True ,
121- )
122- session .run ("git" , "commit" , "-m" , f"Update to CMake { version } " , external = True )
101+ session .run ("git" , "switch" , "-c" , f"update-to-{ name .lower ()} -{ version } " , external = True )
102+ session .run ("git" , "add" , "-u" , * files , external = True )
103+ session .run ("git" , "commit" , "-m" , f"Update to { name } { version } " , external = True )
123104 session .log (
124- 'Complete! Now run: gh pr create --fill --body "Created by running `nox -s bump -- --commit`"'
105+ f 'Complete! Now run: gh pr create --fill --body "Created by running `nox -s { session . name } -- --commit`"'
125106 )
107+
108+
109+ @nox .session
110+ def bump (session : nox .Session ) -> None :
111+ """
112+ Set to a new version, use -- <version>, otherwise will use the latest version.
113+ """
114+ files = (
115+ "CMakeUrls.cmake" ,
116+ "docs/index.rst" ,
117+ "README.rst" ,
118+ "tests/test_distribution.py" ,
119+ "docs/update_cmake_version.rst" ,
120+ )
121+ _bump (session , "CMake" , "kitware/cmake" , "scripts/update_cmake_version.py" , files )
122+
123+
124+ @nox .session (name = "bump-openssl" )
125+ def bump_openssl (session : nox .Session ) -> None :
126+ """
127+ Set openssl to a new version, use -- <version>, otherwise will use the latest version.
128+ """
129+ files = (
130+ "scripts/manylinux-build-and-install-openssl.sh" ,
131+ )
132+ _bump (session , "OpenSSL" , "openssl/openssl" , "scripts/update_openssl_version.py" , files )
0 commit comments