diff --git a/Rakefile b/Rakefile index b198360fe1b..10735173b37 100644 --- a/Rakefile +++ b/Rakefile @@ -1,36 +1,21 @@ - -task :build do - sh "pip wheel ./" -end - +# Dev commands task :test do sh "python setup.py test" end -task :install do - sh "pip install *.whl" -end - -task :upgrade do - sh "pip install -U *.whl" -end - -task :clean do - sh "python setup.py clean" - sh "rm -rf *.whl dist *.egg-info build *egg wheelhouse" -end - -task :upload do - sh "s3cmd put ddtrace-*.whl s3://pypi.datadoghq.com/" -end - task :dev do - sh "pip uninstall ddtrace" + sh "pip uninstall -y ddtrace" sh "pip install -e ." end -task :ci => [:clean, :test, :build] - -task :release => [:ci, :upload] +task :release do + # Use mkwheelhouse to build the wheel, push it to S3 then update the repo index + # If at some point, we need only the 2 first steps: + # - python setup.py bdist_wheel + # - aws s3 cp dist/*.whl s3://pypi.datadoghq.com/#{s3_dir}/ + s3_bucket = 'pypi.datadoghq.com' + s3_dir = ENV['S3_DIR'] + fail "Missing environment variable S3_DIR" if !s3_dir or s3_dir.empty? -task :default => :test + sh "mkwheelhouse s3://#{s3_bucket}/#{s3_dir}/ ." +end diff --git a/circle.yml b/circle.yml index 04daadb4804..69bbf18323f 100644 --- a/circle.yml +++ b/circle.yml @@ -15,3 +15,16 @@ test: - docker run -d -p 6379:6379 redis:3.2 - python2.7 setup.py test - python3.4 setup.py test +deployment: + dev: + branch: /(master)|(develop)/ + # CircleCI is configured to provide VERSION_SUFFIX=$CIRCLE_BRANCH$CIRCLE_BUILD_NUM + commands: + - pip install mkwheelhouse + - S3_DIR=apm_dev rake release + unstable: + tag: /v[0-9]+(\.[0-9]+)*/ + # Nullify VERSION_SUFFIX to deploy the package with its public version + commands: + - pip install mkwheelhouse + - S3_DIR=apm_unstable VERSION_SUFFIX= rake release diff --git a/ddtrace/__init__.py b/ddtrace/__init__.py index 1eb5649c781..7b7cb6fd225 100644 --- a/ddtrace/__init__.py +++ b/ddtrace/__init__.py @@ -1,5 +1,7 @@ +"""Datadog Tracing client""" from .tracer import Tracer +__version__ = '0.2.0' # a global tracer tracer = Tracer() diff --git a/setup.cfg b/setup.cfg index 0656f066541..ce2a2b845af 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,2 +1,5 @@ [nosetests] verbosity=2 + +[bdist_wheel] +universal=1 diff --git a/setup.py b/setup.py index fa3030a8f5f..bca41ccc466 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,6 @@ +from ddtrace import __version__ from setuptools import setup, find_packages +import os tests_require = [ 'nose', @@ -7,12 +9,20 @@ 'elasticsearch', 'psycopg2', 'django', - 'cassandra-driver' + 'cassandra-driver', ] +version = __version__ +# Append a suffix to the version for dev builds +if os.environ.get('VERSION_SUFFIX'): + version = '{v}+{s}'.format( + v=version, + s=os.environ.get('VERSION_SUFFIX'), + ) + setup( name='ddtrace', - version='0.1.8', + version=version, description='Datadog tracing code', url='https://github.com/DataDog/dd-trace-py', author='Datadog, Inc.',