4 from __future__
import absolute_import
5 from __future__
import print_function
13 SETUP_PROJECT =
"qicore"
14 SETUP_DESCRIPTION =
"QiCore Python Module"
16 "manylinux1-x86_64": {
17 "libqicore.so":
"linux/lib/libqicore.so",
18 "qicore.mod":
"linux/share/qi/module/qicore.mod",
20 "macosx-10.12-intel": {
21 "libqicore.dylib":
"mac/lib/libqicore.dylib",
22 "qicore.mod":
"mac/share/qi/module/qicore.mod",
25 "qicore.dll":
"win/lib/qicore.dll",
26 "qicore.mod":
"win/share/qi/module/qicore.mod",
29 PATH_HERE = os.path.abspath(os.path.dirname(__file__))
33 """ Search a file by name in previous folder and return its path """
34 search_folder = os.environ.get(
"QIPYTHON_BUILD_FOLDER")
35 if not search_folder
or not os.path.isdir(search_folder):
36 search_folder = os.path.join(PATH_HERE,
"..")
37 for directory, _folders, content
in os.walk(search_folder):
38 if filename
not in content:
40 return os.path.join(directory, filename)
44 DEFAULT_VERSION = datetime.datetime.now().strftime(
"%y.%m.%d")
45 SETUP_VERSION = os.environ.get(
"QIPYTHON_BUILD_VERSION", DEFAULT_VERSION)
47 [metadata]\nlicense_file = LICENSE.txt\n
48 [bdist_wheel]\npython-tag = cp27\nplat-name = %s\nplat-tag = %s
50 SETUP_PLATFORM =
"manylinux1-x86_64"
51 SETUP_SYSTEM =
"Operating System :: POSIX :: Linux"
52 if "darwin" in sys.platform:
53 SETUP_PLATFORM =
"macosx-10.12-intel"
54 SETUP_SYSTEM =
"Operating System :: MacOS :: MacOS X"
55 elif "win" in sys.platform:
56 SETUP_PLATFORM =
"win-amd64"
57 SETUP_SYSTEM =
"Operating System :: Microsoft :: Windows"
59 with open(os.path.join(PATH_HERE,
"setup.cfg"),
"w")
as file_config:
60 file_config.write(SETUP_CONFIG % (SETUP_PLATFORM, SETUP_PLATFORM))
65 with open(os.path.join(PATH_HERE,
"README.md"))
as file_desc:
66 LONG_DESCRIPTION = file_desc.read()
71 PLATFORM_FILES = SETUP_FILES.get(SETUP_PLATFORM)
72 for filename
in PLATFORM_FILES:
75 dest_path = os.path.join(PATH_HERE, SETUP_PROJECT, PLATFORM_FILES.get(filename))
76 if not os.path.isdir(os.path.dirname(dest_path)):
77 os.makedirs(os.path.dirname(dest_path))
78 shutil.copy(source_path, dest_path)
79 print(
" + File %s added to the Package." % filename)
81 print(
" ! File %s is missing !" % filename)
85 version=SETUP_VERSION,
86 description=SETUP_DESCRIPTION,
87 long_description=LONG_DESCRIPTION,
88 keywords=
"naoqi softbank nao pepper romeo robot",
89 url=
"http://doc.aldebaran.com",
90 author=
"SoftBank Robotics",
91 author_email=
"release@softbankrobotics.com",
92 platforms=SETUP_PLATFORM,
93 python_requires=
">=2.6, <3",
94 packages=[SETUP_PROJECT],
95 package_dir={SETUP_PROJECT: SETUP_PROJECT},
97 SETUP_PROJECT: [PLATFORM_FILES.get(filename)
for filename
in PLATFORM_FILES]
99 include_package_data=
True,
100 install_requires=[
"qi"],
102 "Development Status :: 5 - Production/Stable",
103 "Intended Audience :: Developers",
104 "Topic :: Software Development :: Embedded Systems",
105 "Framework :: Robot Framework :: Tool",
106 "Programming Language :: Python :: 2",
111 os.remove(os.path.join(PATH_HERE,
"setup.cfg"))
113 for name
in os.listdir(os.path.join(PATH_HERE, SETUP_PROJECT)):
114 path = os.path.join(PATH_HERE, SETUP_PROJECT, name)
115 if os.path.isdir(path):
116 shutil.rmtree(path, ignore_errors=
True)