Allow Customization of version and name of python packages
from setuptools import setup
from distutils.core import Extension
+from distutils.util import strtobool
+from os import environ
import subprocess
import sys
@@ -28,18 +30,32 @@ import xml.etree.ElementTree as ET
from os.path import dirname, realpath, join
def get_version():
+ use_full_pom_name = strtobool(environ.get('USE_FULL_POM_NAME', 'False'))
+
# Get the pulsar version from pom.xml
TOP_LEVEL_PATH = dirname(dirname(dirname(realpath(__file__))))
POM_PATH = join(TOP_LEVEL_PATH, 'pom.xml')
root = ET.XML(open(POM_PATH).read())
version = root.find('{http://maven.apache.org/POM/4.0.0}version').text.strip()
+ if use_full_pom_name:
+ return version
+ else:
# Strip the '-incubating' suffix, since it prevents the packages
# from being uploaded into PyPI
return version.split('-')[0]
+def get_name():
+ postfix = environ.get('NAME_POSTFIX', '')
+ base = 'pulsar-client'
+ return base + postfix
+
VERSION = get_version()
+NAME = get_name()
+
+print(VERSION)
+print(NAME)
if sys.version_info[0] == 2:
PY2 = True
@@ -79,7 +95,7 @@ if PY2:
dependencies += ['enum34']
setup(
- name="pulsar-client",
+ name=NAME,
version=VERSION,
packages=['pulsar', 'pulsar.schema', 'pulsar.functions'],
cmdclass={'build_ext': my_build_ext},
