setup.py 2.5 KB
Newer Older
T
for whl  
tangwei 已提交
1 2 3
"""
setup for fleet-rec.
"""
T
tangwei 已提交
4
import os
T
tangwei 已提交
5
from setuptools import setup, find_packages
T
tangwei 已提交
6 7
import tempfile
import shutil
T
for whl  
tangwei 已提交
8

T
tangwei 已提交
9 10 11 12
requires = [
    "paddlepaddle == 1.7.2",
    "pyyaml >= 5.1.1"
]
T
for whl  
tangwei 已提交
13 14 15 16 17

about = {}
about["__title__"] = "fleet-rec"
about["__version__"] = "0.0.2"
about["__description__"] = "fleet-rec"
T
tangwei12 已提交
18 19 20 21
about["__author__"] = "seiriosPlus"
about["__author_email__"] = "tangwei12@baidu.com"
about["__url__"] = "https://github.com/seiriosPlus/FleetRec"

T
for whl  
tangwei 已提交
22 23
readme = "..."

T
tangwei 已提交
24 25 26 27 28 29 30 31 32

def run_cmd(command):
    assert command is not None and isinstance(command, str)
    return os.popen(command).read().strip()


def build(dirname):
    package_dir = os.path.dirname(os.path.abspath(__file__))
    run_cmd("cp -r {}/* {}".format(package_dir, dirname))
T
tangwei 已提交
33 34
    run_cmd("mkdir {}".format(os.path.join(dirname, "fleetrec")))
    run_cmd("mv {}/* {}".format(os.path.join(dirname, "fleet_rec"), os.path.join(dirname, "fleetrec")))
T
tangwei 已提交
35 36 37 38
    run_cmd("mv {} {}".format(os.path.join(dirname, "doc"), os.path.join(dirname, "fleetrec")))
    run_cmd("mv {} {}".format(os.path.join(dirname, "models"), os.path.join(dirname, "fleetrec")))
    run_cmd("mv {} {}".format(os.path.join(dirname, "tools"), os.path.join(dirname, "fleetrec")))

T
tangwei 已提交
39
    packages = find_packages(dirname, include=('fleetrec.*'))
T
tangwei 已提交
40
    package_dir = {'': dirname}
41
    package_data = {}
T
tangwei 已提交
42 43 44

    models_copy = ['data/*.txt', 'data/*/*.txt', '*.yaml', '*.sh', 'tree/*.npy', 'tree/*.txt']
    engine_copy = ['*/*.sh']
45 46
    for package in packages:
        if package.startswith("fleetrec.models."):
T
tangwei 已提交
47 48 49
            package_data[package] = models_copy
        if package.startswith("fleetrec.core.engine"):
            package_data[package] = engine_copy
T
tangwei 已提交
50

T
tangwei 已提交
51 52 53 54 55 56 57 58 59 60
    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 已提交
61
        package_data=package_data,
T
tangwei 已提交
62 63 64 65 66 67 68 69 70
        python_requires=">=2.7",
        install_requires=requires,
        zip_safe=False
    )


dirname = tempfile.mkdtemp()
build(dirname)
shutil.rmtree(dirname)
T
for whl  
tangwei 已提交
71 72 73

print('''
\033[32m
T
tangwei 已提交
74 75
  _   _   _   _   _   _   _   _   _
 / \ / \ / \ / \ / \ / \ / \ / \ / \
T
tangwei12 已提交
76
( F | L | E | E | T | - | R | E | C )
T
tangwei 已提交
77
 \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/
T
for whl  
tangwei 已提交
78 79 80 81 82 83
\033[0m
\033[34m
Installation Complete. Congratulations!
How to use it ? Please visit our webside: https://github.com/seiriosPlus/FleetRec
\033[0m
''')