Move DD code into its own directory (#6)

This commit is contained in:
Diego Hurtado
2020-04-08 11:39:44 -06:00
committed by GitHub
parent 72b40ba5f9
commit 5aee3ce32e
611 changed files with 0 additions and 0 deletions

39
reference/scripts/build-dist Executable file
View File

@ -0,0 +1,39 @@
#!/usr/bin/env bash
set -ex
# Determine where "../dist" is
PARENT_DIR="$( cd "$(dirname "${0}")/../" ; pwd -P )"
DIST_DIR="${PARENT_DIR}/dist"
# Remove and recreate dist/ directory where our release wheels/source distribution will go
rm -rf "${DIST_DIR}"
mkdir "${DIST_DIR}"
build_script=$(cat <<'EOF'
set -ex
# Build linux wheels from the source distribution we created
for PYBIN in /opt/python/*/bin;
do
"${PYBIN}/pip" wheel --no-deps /dd-trace-py/dist/*.tar.gz -w /dd-trace-py/dist
done
# Build manylinux wheels from the linux wheels we just created
for whl in /dd-trace-py/dist/*-linux_${ARCH}.whl;
do
auditwheel repair "${whl}" -w /dd-trace-py/dist
# Remove linux wheel since we only want the manylinux wheels
rm "${whl}"
done
EOF
)
# First build a source distribution for our package
python setup.py sdist --dist-dir dist
# Build x86_64 linux and manylinux wheels
docker run -it --rm -v "${PARENT_DIR}:/dd-trace-py" -e "ARCH=x86_64" quay.io/pypa/manylinux1_x86_64 /bin/bash -c "${build_script}"
# Build i686 linux and manylinux wheels
docker run -it --rm -v "${PARENT_DIR}:/dd-trace-py" -e "ARCH=i686" quay.io/pypa/manylinux1_i686 linux32 /bin/bash -c "${build_script}"

5
reference/scripts/ddtest Executable file
View File

@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -e
docker-compose run --rm testrunner $*

57
reference/scripts/mkwheelhouse Executable file
View File

@ -0,0 +1,57 @@
#!/usr/bin/env python
import os
import shutil
import tempfile
import mkwheelhouse
S3_BUCKET = 'pypi.datadoghq.com'
S3_DIR = os.environ['S3_DIR']
# DEV: This is the same `mkwheelhouse.build_wheels` except we are running `python setup.py sdist` instead
def build_sdist():
build_dir = tempfile.mkdtemp(prefix='mkwheelhouse-')
args = [
'python', 'setup.py', 'sdist',
'--dist-dir', build_dir,
]
mkwheelhouse.spawn(args)
return build_dir
# DEV: This is the same as `mkwheelhouse.Bucket.make_index`, except we include `*.whl` and `*.tar.gz` files
def make_index(bucket):
doc, tag, text = mkwheelhouse.yattag.Doc().tagtext()
with tag('html'):
for key in bucket.list():
# Skip over any non-wheel or non-source dist
if not key.name.endswith('.whl') and not key.name.endswith('.tar.gz'):
continue
with tag('a', href=bucket.generate_url(key)):
text(key.name)
doc.stag('br')
return doc.getvalue()
# DEV: This is the same as `mkwheelhouse.run` except we hard code some values and use our custom functions instead
def run():
s3_url = 's3://{0}/{1}'.format(S3_BUCKET, S3_DIR)
acl = 'private'
bucket = mkwheelhouse.Bucket(s3_url)
if not bucket.has_key('index.html'): # noqa
bucket.put('<!DOCTYPE html><html></html>', 'index.html', acl=acl)
index_url = bucket.generate_url('index.html')
build_dir = build_sdist()
bucket.sync(build_dir, acl=acl)
bucket.put(make_index(bucket), key='index.html', acl=acl)
shutil.rmtree(build_dir)
print('mkwheelhouse: index written to', index_url)
if __name__ == '__main__':
run()

View File

@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -e
PATTERN="$1"
shift
# CircleCI has a bug in its workspace code where it can't handle filenames with some chars
CLEANED_PATTERN=`echo $PATTERN | tr '^?()$' '_'`
exec tox -l | grep "$PATTERN" | tr '\n' ',' | xargs -I ARGS tox --result-json /tmp/"$CLEANED_PATTERN".results -e ARGS -- $@