@@ -76,12 +76,8 @@ def docs(session: nox.Session) -> str:
76
76
print ("Unsupported argument to docs" )
77
77
78
78
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 ()
85
81
parser .add_argument (
86
82
"--commit" , action = "store_true" , help = "Make a branch and commit."
87
83
)
@@ -92,34 +88,45 @@ def bump(session: nox.Session) -> None:
92
88
93
89
if args .version is None :
94
90
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 ()
98
92
else :
99
93
version = args .version
100
94
101
95
session .install ("requests" )
102
96
103
97
extra = ["--quiet" ] if args .commit else []
104
- session .run ("python" , "scripts/update_cmake_version.py" , version , * extra )
98
+ session .run ("python" , script , version , * extra )
105
99
106
100
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 )
123
104
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`"'
125
106
)
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