This repository was archived by the owner on Oct 15, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate_installer.py
129 lines (98 loc) · 3.65 KB
/
create_installer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
# Contact: http://engin.io
#
# You may use this file under the terms of the 3-clause BSD license.
# See the file LICENSE from this package for details.
#
from __future__ import print_function
import os
import shutil
import subprocess
import sys
# Qt
qmake = "qmake"
make = "make"
if sys.platform == "win32":
make = "jom"
# from the installer framework
binarycreator = "binarycreator"
# visual studio
#setEnv = "c:\\Program Files\\Microsoft SDKs\\Windows\\v7.1\\Bin\\SetEnv.Cmd"
# Build Enginio
subprocess.check_call(["git", "clean", "-xdf"])
os.mkdir("build")
os.chdir("build")
# this is evil - keep the process alive so that we can set the right sdk env here
# and it may not work, at least currently I have conflicts with VS 7.1 and 8
#process = subprocess.Popen('cmd.exe /k\n', shell=True, stdin=subprocess.PIPE)
#process.stdin.write('call "' + setEnv + '"\n')
#process.stdin.write(qmake + " ../..\r\n")
#process.stdin.write(jom + "\n")
# docs build currently errors out!
# process.stdin.write("nmake docs\n")
#process.stdin.write("exit\n")
#process.communicate()
subprocess.check_call([qmake, "../.."])
print("Compiling Enginio...")
try:
from subprocess import DEVNULL # py3k
except ImportError:
DEVNULL = open(os.devnull, 'wb')
subprocess.check_call([make,], stdout=DEVNULL)
if sys.platform == "win32": # bug with jom subtargets
subprocess.check_call(["nmake", "docs"])
else:
subprocess.check_call([make, "docs"])
# Copy files around
os.chdir("../..")
packages = {
"com.digia.enginio": ["include", "lib", "qml", ], #"doc/enginio-qt.qch", ],
"com.digia.enginioExamples": ["examples",],
#"com.digia.enginioDocumentation": ["doc/enginio-qt",],
"com.digia.enginioSources": ["src",],
}
print("Creating installer...")
for package in packages:
for path in packages[package]:
sourcePath = path
if not os.path.exists(sourcePath):
sourcePath = "dist/build/" + path
if not os.path.exists(sourcePath):
print("ERROR: Could not find path '" + path + "' in source or build directory.")
exit(1)
print("Creating ", path, " dir.")
dest = "dist/packages/" + package + "/data/" + path
if os.path.exists(dest):
print("ERROR: ", dest, " exists already.")
exit(1)
if os.path.isfile(sourcePath):
os.mkdir(os.path.dirname(dest))
shutil.copyfile(sourcePath, dest)
else:
shutil.copytree(sourcePath, dest)
# copy the real headers
# src/enginio_client
# src/enginio_plugin
headerPath = "dist/packages/com.digia.enginio/data/include/Enginio/"
#FIXME FIXME FIXME version string
privateHeaderPath = headerPath + "0.5.0/Enginio/private"
import glob
allHeaders = glob.glob("src/*/*.h")
for header in allHeaders:
fileName = header[header.rindex(os.sep):]
if header.endswith("_p.h"):
print("Copy ", header, " to ", privateHeaderPath + fileName)
shutil.copyfile(header, privateHeaderPath + fileName)
else:
print("Copy ", header, " to ", headerPath + fileName)
shutil.copyfile(header, headerPath + fileName)
os.chdir("dist")
# the Module .pri file is special - take the one from mkspecs/modules_inst
modulesPath = "packages/com.digia.enginio/data/mkspecs/modules"
os.mkdir("packages/com.digia.enginio/data/mkspecs")
os.mkdir(modulesPath)
shutil.copyfile("build/mkspecs/modules-inst/qt_lib_enginio.pri", modulesPath + "/qt_lib_enginio.pri")
subprocess.check_call([binarycreator, "-c", "config" + os.sep + "config.xml", "-p", "packages", "EnginioInstaller"])
print("Installer created.")