onnxruntime/tools/python/update_version.py
stevenlix 814638cdff
Cherry pick PRs to Rel-1.3.1 (#4198)
* link to folder instead of READMEs inside folder (#3938)

otherwise hard to find the source code

* [Node.js binding] fix linux build (#3927)

* [Node.js binding] add build flag for node.js binding (#3948)

* [Nodejs binding] create a new pipeline to generate signed binaries (#4104)

* add yml files

* update pipeline

* fix yaml syntax

* yaml pop BuildCSharp

* udpate yaml

* do not stage codesign summary

* fix build: pipeline Node.js version to 12.16.3 (#4145)

* [Node.js binding] upgrade node-addon-api to 3.0 (#4148)

* [Node.js binding] add linux and mac package (#4157)

* try mac pipeline

* fix path separator

* copy prebuilds folder

* split esrp yaml for win/mac

* disable mac signing temporarily

* add linux

* fix indent

* add nodetool in linux

* add nodetool in win-ci-2019

* replace linux build by custom docker scripts

* use manylinux as node 12.16 not working on centos6

* try ubuntu

* loosen timeout for test case - multiple runs calls

* add script to support update nodejs binding version (#4164)

* [java] Adds a CUDA test (#3956)

* [java] - adding a cuda enabled test.

* Adding --build_java to the windows gpu ci pipeline.

* Removing a stray line from the unit tests that always enabled CUDA for Java.

* Update OnnxRuntime.java for OS X environment. (#3985)

onnxruntime init failure due to wrong path of reading native libraries. In OS X 64 system, the arch name is detected as x86 which generates invalid path to read native libraries.

Exception java.lang.UnsatisfiedLinkError: no onnxruntime in java.library.path
	at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
	at java.lang.Runtime.loadLibrary0(Runtime.java:870)
	at java.lang.System.loadLibrary(System.java:1122)
	at ai.onnxruntime.OnnxRuntime.load(OnnxRuntime.java:174)
	at ai.onnxruntime.OnnxRuntime.init(OnnxRuntime.java:81)
	at ai.onnxruntime.OrtEnvironment.<clinit>(OrtEnvironment.java:24)

* Create Java publishing pipeline (#3944)

Create CPU and GPu Java publishing pipelines. Final jars are tested on all platforms. However, signing and publishing to maven are manual steps.

* Change group id to com.microsoft.onnxruntime per requirements.

* Java GPu artifact naming (#4179)

Modify gradle build so artifactID has _gpu for GPU builds.
  Pass USE_CUDA flag on CUDA build
  Adjust publishing pipelines to extract POM from a correct path.

Co-Authored-By: @Craigacp

* bump up ORT version to 1.3.1 (#4181)

* move back to toolset 14.16 to possibly work around nvcc bug (#4180)

* Symbolic shape inference exit on models without onnx opset used (#4090)

* Symbolic shape inference exit on models without onnx opset used

* Temporary fix for ConvTranspose with symbolic input dims

Co-authored-by: Changming Sun <me@sunchangming.com>

* Fix Nuphar test failure

* Enlarge the read buffer size in C#/Java test code (#4150)

1. Enlarge the read buffer size further, so that our code can run even faster. TODO: need apply the similar changes to python some other language bindings.
2. Add coreml_VGG16_ImageNet to the test exclusion set of x86_32. It is not a new model but previously we didn't run the test against x86_32.

* Temporarily disable windows static analysis CI job

* skip model coreml_Imputer-LogisticRegression_sklearn_load_breast_cancer

* Delete unused variable

Co-authored-by: Prasanth Pulavarthi <prasantp@microsoft.com>
Co-authored-by: Yulong Wang <yulongw@microsoft.com>
Co-authored-by: Adam Pocock <adam.pocock@oracle.com>
Co-authored-by: jji2019 <49252772+jji2019@users.noreply.github.com>
Co-authored-by: Dmitri Smirnov <yuslepukhin@users.noreply.github.com>
Co-authored-by: Dmitri Smirnov <dmitrism@microsoft.com>
Co-authored-by: George Wu <jywu@microsoft.com>
Co-authored-by: KeDengMS <kedeng@microsoft.com>
Co-authored-by: Changming Sun <me@sunchangming.com>
Co-authored-by: Changming Sun <chasun@microsoft.com>
2020-06-12 11:27:02 -07:00

103 lines
4.2 KiB
Python
Executable file

import os
import json
def update_version():
version = ''
cwd = os.path.dirname(os.path.realpath(__file__))
with open(os.path.join(cwd, '..', '..', 'VERSION_NUMBER')) as f:
version = f.readline().strip()
lines = []
current_version = ''
file_path = os.path.join(cwd, '..', '..', 'docs', 'Versioning.md')
with open(file_path) as f:
lines = f.readlines()
for line in lines:
if line.startswith('|'):
sections = line.split('|')
if len(sections) == 8 and sections[1].strip()[0].isdigit() :
current_version = sections[1].strip()
break
print ('Current version of ORT seems to be: ' + current_version)
if version != current_version:
with open(file_path, 'w') as f:
for i,line in enumerate(lines):
f.write(line)
if line.startswith('|--'):
sections = lines[i+1].split('|')
# Make sure there are no 'False Positive' version additions
# by making sure the line we are building a new line from
# contains the current_version
if len(sections) > 1 and sections[1].strip() == current_version:
sections[1] = ' ' + version + ' '
new_line = '|'.join(sections)
f.write(new_line)
lines = []
current_version = ''
file_path = os.path.join(cwd, '..', '..', 'docs', 'python', 'README.rst')
with open(file_path) as f:
lines = f.readlines()
for line in lines:
sections = line.strip().split('.')
if len(sections) == 3 and sections[0].isdigit() and sections[1].isdigit() and sections[2].isdigit():
current_version = line.strip()
break
if version != current_version:
inserted = False
with open(file_path,'w') as f:
for line in lines:
sections = line.strip().split('.')
if inserted == False and len(sections) == 3 and sections[0].isdigit() and sections[1].isdigit() and sections[2].isdigit():
f.write(version + '\n')
f.write('^^^^^\n\n')
f.write('Release Notes : https://github.com/Microsoft/onnxruntime/releases/tag/v' + version.strip() + '\n\n')
inserted = True
f.write(line)
lines = []
current_version = ''
file_path = os.path.join(cwd, '..', '..', 'package', 'rpm', 'onnxruntime.spec')
with open(file_path) as f:
lines = f.readlines()
for line in lines:
if line.startswith('Version:'):
current_version = line.split(':')[1].strip()
break
if version != current_version:
with open(file_path, 'w') as f:
for line in lines:
if line.startswith('Version:'):
f.write('Version: ' + version + '\n')
continue
f.write(line)
lines = []
current_version = ''
file_path = os.path.join(cwd, '..', '..', 'onnxruntime', '__init__.py')
with open(file_path) as f:
lines = f.readlines()
for line in lines:
if line.startswith('__version__'):
current_version = line.split('=')[1].strip()[1:-1]
break
if version != current_version:
with open(file_path, 'w') as f:
for line in lines:
if line.startswith('__version__'):
f.write('__version__ = "' + version + '"\n')
continue
f.write(line)
# update version for node.js binding
current_version = ''
file_names = ['package.json', 'package-lock.json']
file_paths = [os.path.join(cwd, '..', '..', 'nodejs', file_name) for file_name in file_names]
for file_path in file_paths:
with open(file_path) as f:
content = json.load(f)
current_version = content['version']
if version != current_version:
content['version'] = version
with open(file_path, 'w') as f:
json.dump(content, f, indent=2)
if __name__ == "__main__":
update_version()