Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fe6dc94

Browse files
authored
Add a version attribute (#81)
1 parent d307b98 commit fe6dc94

File tree

5 files changed

+27
-6
lines changed

5 files changed

+27
-6
lines changed

pkg/mac/build-mac-wheels.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ cd "${ROOT_DIR}"
2525

2626
source pkg/mac/common.sh
2727

28-
PYTHON_CLIENT_VERSION=$(cat version.txt | xargs)
28+
PYTHON_CLIENT_VERSION=$(grep -v '^#' pulsar/__about__.py | cut -d "=" -f2 | sed "s/'//g")
2929

3030
PYTHON_VERSION=$1
3131

pulsar/__about__.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
#
19+
__version__='3.1.0a1'

pulsar/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@
4848
from _pulsar import Result, CompressionType, ConsumerType, InitialPosition, PartitionsRoutingMode, BatchingType, \
4949
LoggerLevel, BatchReceivePolicy # noqa: F401
5050

51+
from pulsar.__about__ import __version__
52+
5153
from pulsar.exceptions import *
5254

5355
from pulsar.functions.function import Function

setup.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,12 @@
2727

2828

2929
def get_version():
30-
# Get the pulsar version from version.txt
3130
root = path.dirname(path.realpath(__file__))
32-
version_file = path.join(root, 'version.txt')
33-
with open(version_file) as f:
34-
return f.read().strip()
31+
version_file = path.join(root, 'pulsar', '__about__.py')
32+
version = {}
33+
with open(version_file) as fp:
34+
exec(fp.read(), version)
35+
return version['__version__']
3536

3637

3738
def get_name():

version.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)