Skip to content

Commit ec05e7f

Browse files
committed
Add pip installation files
Signed-off-by: Yong Tang <[email protected]>
1 parent e51fdda commit ec05e7f

File tree

3 files changed

+136
-0
lines changed

3 files changed

+136
-0
lines changed

Diff for: MANIFEST.in

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
recursive-include tensorflow_io *.so

Diff for: build_pip_pkg.sh

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
#!/usr/bin/env bash
2+
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
# ==============================================================================
16+
set -e
17+
set -x
18+
19+
PLATFORM="$(uname -s | tr 'A-Z' 'a-z')"
20+
21+
PIP_FILE_PREFIX="bazel-bin/build_pip_pkg.runfiles/__main__/"
22+
23+
function main() {
24+
while [[ ! -z "${1}" ]]; do
25+
if [[ ${1} == "make" ]]; then
26+
echo "Using Makefile to build pip package."
27+
PIP_FILE_PREFIX=""
28+
else
29+
DEST=${1}
30+
fi
31+
shift
32+
done
33+
34+
if [[ -z ${DEST} ]]; then
35+
echo "No destination dir provided"
36+
exit 1
37+
fi
38+
39+
# Create the directory, then do dirname on a non-existent file inside it to
40+
# give us an absolute paths with tilde characters resolved to the destination
41+
# directory.
42+
mkdir -p ${DEST}
43+
DEST=$(readlink -f "${DEST}")
44+
echo "=== destination directory: ${DEST}"
45+
46+
TMPDIR=$(mktemp -d -t tmp.XXXXXXXXXX)
47+
48+
echo $(date) : "=== Using tmpdir: ${TMPDIR}"
49+
50+
echo "=== Copy TensorFlow IO files"
51+
52+
cp ${PIP_FILE_PREFIX}setup.py "${TMPDIR}"
53+
cp ${PIP_FILE_PREFIX}MANIFEST.in "${TMPDIR}"
54+
cp ${PIP_FILE_PREFIX}LICENSE "${TMPDIR}"
55+
rsync -avm -L --exclude='*_test.py' ${PIP_FILE_PREFIX}tensorflow_io "${TMPDIR}"
56+
57+
pushd ${TMPDIR}
58+
echo $(date) : "=== Building wheel"
59+
60+
python setup.py bdist_wheel
61+
62+
cp dist/*.whl "${DEST}"
63+
popd
64+
rm -rf ${TMPDIR}
65+
echo $(date) : "=== Output wheel file is in: ${DEST}"
66+
}
67+
68+
main "$@"

Diff for: setup.py

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
# ==============================================================================
15+
"""Setup for pip package."""
16+
from __future__ import absolute_import
17+
from __future__ import division
18+
from __future__ import print_function
19+
20+
from setuptools import find_packages
21+
from setuptools import setup
22+
from setuptools.dist import Distribution
23+
24+
__version__ = '0.0.1'
25+
REQUIRED_PACKAGES = [
26+
'tensorflow >= 1.12.0',
27+
]
28+
project_name = 'tensorflow-io'
29+
30+
class BinaryDistribution(Distribution):
31+
"""This class is needed in order to create OS specific wheels."""
32+
33+
def has_ext_modules(self):
34+
return True
35+
36+
37+
setup(
38+
name=project_name,
39+
version=__version__,
40+
description=('TensorFlow IO'),
41+
author='Google Inc.',
42+
author_email='[email protected]',
43+
# Contained modules and scripts.
44+
packages=find_packages(),
45+
install_requires=REQUIRED_PACKAGES,
46+
# Add in any packaged data.
47+
include_package_data=True,
48+
zip_safe=False,
49+
distclass=BinaryDistribution,
50+
# PyPI package information.
51+
classifiers=[
52+
'Development Status :: 4 - Beta',
53+
'Intended Audience :: Developers',
54+
'Intended Audience :: Education',
55+
'Intended Audience :: Science/Research',
56+
'License :: OSI Approved :: Apache Software License',
57+
'Programming Language :: Python :: 2.7',
58+
'Programming Language :: Python :: 3.4',
59+
'Programming Language :: Python :: 3.5',
60+
'Programming Language :: Python :: 3.6',
61+
'Topic :: Scientific/Engineering :: Mathematics',
62+
'Topic :: Software Development :: Libraries :: Python Modules',
63+
'Topic :: Software Development :: Libraries',
64+
],
65+
license='Apache 2.0',
66+
keywords='tensorflow io machine learning',
67+
)

0 commit comments

Comments
 (0)