setup.py 4.4 KB
Newer Older
C
Chengmo 已提交
1 2
# -*- coding: utf-8 -*-

C
Chengmo 已提交
3
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
T
tangwei 已提交
4 5 6 7 8 9 10 11 12 13 14 15
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
T
for whl  
tangwei 已提交
16
"""
17
setup for paddle-rec.
T
for whl  
tangwei 已提交
18
"""
T
tangwei 已提交
19

T
tangwei 已提交
20
import os
T
tangwei 已提交
21

T
tangwei 已提交
22
from setuptools import setup, find_packages
T
tangwei 已提交
23
import shutil
T
tangwei 已提交
24 25
import tempfile

C
Chengmo 已提交
26
requires = ["paddlepaddle == 1.7.2", "PyYAML >= 5.1.1"]
T
for whl  
tangwei 已提交
27 28

about = {}
29
about["__title__"] = "paddle-rec"
C
Chengmo 已提交
30
about["__version__"] = "0.1.0"
31 32 33 34
about["__description__"] = "paddle-rec"
about["__author__"] = "paddle-dev"
about["__author_email__"] = "paddle-dev@baidu.com"
about["__url__"] = "https://github.com/PaddlePaddle/PaddleRec"
T
tangwei12 已提交
35

T
for mat  
tangwei 已提交
36
readme = ""
T
for whl  
tangwei 已提交
37

T
tangwei 已提交
38 39 40

def build(dirname):
    package_dir = os.path.dirname(os.path.abspath(__file__))
T
tangwei 已提交
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
    shutil.copytree(
        package_dir, dirname, ignore=shutil.ignore_patterns(".git"))
    os.mkdir(os.path.join(dirname, "paddlerec"))
    shutil.move(
        os.path.join(dirname, "core"), os.path.join(dirname, "paddlerec"))
    shutil.move(
        os.path.join(dirname, "doc"), os.path.join(dirname, "paddlerec"))
    shutil.move(
        os.path.join(dirname, "models"), os.path.join(dirname, "paddlerec"))
    shutil.move(
        os.path.join(dirname, "tests"), os.path.join(dirname, "paddlerec"))
    shutil.move(
        os.path.join(dirname, "tools"), os.path.join(dirname, "paddlerec"))

    for f in os.listdir(dirname):
        if os.path.isdir(f):
            continue
        if os.path.splitext(f)[1] == ".py":
            shutil.move(
                os.path.join(dirname, f), os.path.join(dirname, "paddlerec"))
T
tangwei 已提交
61

62
    packages = find_packages(dirname, include=('paddlerec.*'))
T
tangwei 已提交
63
    package_dir = {'': dirname}
64
    package_data = {}
T
tangwei 已提交
65

T
tangwei 已提交
66 67
    models_copy = [
        'data/*.txt', 'data/*/*.txt', '*.yaml', '*.sh', 'tree/*.npy',
68
        'tree/*.txt', 'data/sample_data/*', 'data/sample_data/train/*',
69 70
        'data/sample_data/infer/*', 'data/*/*.csv', 'Criteo_data/*',
        'Criteo_data/sample_data/train/*'
T
tangwei 已提交
71
    ]
X
xujiaqi01 已提交
72

C
Chengmo 已提交
73
    engine_copy = ['*/*.sh', '*/*.template']
74
    for package in packages:
75
        if package.startswith("paddlerec.models."):
T
tangwei 已提交
76
            package_data[package] = models_copy
77
        if package.startswith("paddlerec.core.engine"):
T
tangwei 已提交
78
            package_data[package] = engine_copy
T
tangwei 已提交
79

T
tangwei 已提交
80 81 82 83 84 85 86 87 88 89
    setup(
        name=about["__title__"],
        version=about["__version__"],
        description=about["__description__"],
        long_description=readme,
        author=about["__author__"],
        author_email=about["__author_email__"],
        url=about["__url__"],
        packages=packages,
        package_dir=package_dir,
T
tangwei 已提交
90
        package_data=package_data,
T
tangwei 已提交
91 92
        python_requires=">=2.7",
        install_requires=requires,
T
tangwei 已提交
93
        zip_safe=False)
T
tangwei 已提交
94 95


T
tangwei 已提交
96
dirname = tempfile.mktemp()
T
tangwei 已提交
97 98
build(dirname)
shutil.rmtree(dirname)
T
for whl  
tangwei 已提交
99

C
Chengmo 已提交
100
print(u'''
T
for whl  
tangwei 已提交
101
\033[32m
C
Chengmo 已提交
102 103 104 105 106 107
██████╗  █████╗ ██████╗ ██████╗ ██╗     ███████╗██████╗ ███████╗ ██████╗
██╔══██╗██╔══██╗██╔══██╗██╔══██╗██║     ██╔════╝██╔══██╗██╔════╝██╔════╝
██████╔╝███████║██║  ██║██║  ██║██║     █████╗  ██████╔╝█████╗  ██║
██╔═══╝ ██╔══██║██║  ██║██║  ██║██║     ██╔══╝  ██╔══██╗██╔══╝  ██║
██║     ██║  ██║██████╔╝██████╔╝███████╗███████╗██║  ██║███████╗╚██████╗
╚═╝     ╚═╝  ╚═╝╚═════╝ ╚═════╝ ╚══════╝╚══════╝╚═╝  ╚═╝╚══════╝ ╚═════╝
T
for whl  
tangwei 已提交
108 109 110
\033[0m
\033[34m
Installation Complete. Congratulations!
111
How to use it ? Please visit our webside: https://github.com/PaddlePaddle/PaddleRec
T
for whl  
tangwei 已提交
112 113
\033[0m
''')