Skip to content

Commit

Permalink
Merge pull request #625 from patmarion/update-mac-build
Browse files Browse the repository at this point in the history
Update to python3
  • Loading branch information
patmarion committed Sep 21, 2019
2 parents 43d540f + bbc2979 commit 7139b80
Show file tree
Hide file tree
Showing 201 changed files with 1,493 additions and 857 deletions.
12 changes: 6 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ matrix:
include:

- os: linux
env: UBUNTU_TEST_VERSION=14 USE_LCM=ON MAKE_PACKAGE=ON MAKE_DOCS=ON
env: UBUNTU_TEST_VERSION=18

- os: linux
env: UBUNTU_TEST_VERSION=16 USE_LCM=ON MAKE_PACKAGE=ON
env: UBUNTU_TEST_VERSION=16

- os: linux
env: UBUNTU_TEST_VERSION=14
env: UBUNTU_TEST_VERSION=16 USE_LCM=ON MAKE_PACKAGE=ON MAKE_DOCS=ON

- os: linux
env: UBUNTU_TEST_VERSION=14 USE_LCM=ON USE_LCMGL=ON USE_LIBBOT=ON
env: UBUNTU_TEST_VERSION=16 USE_LCM=ON USE_LCMGL=ON USE_LIBBOT=ON

- os: osx
osx_image: xcode7.3
env: USE_LCM=ON USE_LIBBOT=OFF USE_LCMGL=OFF MAKE_PACKAGE=ON
osx_image: xcode10.2
env: USE_LCM=OFF USE_LIBBOT=OFF USE_LCMGL=OFF MAKE_PACKAGE=ON


language: generic
Expand Down
2 changes: 1 addition & 1 deletion CTestConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ set(CTEST_PROJECT_NAME "director")
set(CTEST_NIGHTLY_START_TIME "00:00:00 EDT")

set(CTEST_DROP_METHOD "http")
set(CTEST_DROP_SITE "patmarion.synology.me")
set(CTEST_DROP_SITE "cdash.patmarion.com")
set(CTEST_DROP_LOCATION "/submit.php?project=director")
set(CTEST_DROP_SITE_CDASH TRUE)
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ The required 3rd party dependencies are:

- Qt4 or Qt5 (Qt 4.8.7 recommended)
- VTK 6.2+ (VTK 7.1.1 recommended)
- Python 2.7 and NumPy
- Python 3.4+ and NumPy

Additionally, you will need CMake 2.8 or greater to configure the source code.

Expand Down
30 changes: 27 additions & 3 deletions cmake/dd-macros.cmake
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
macro(setup_python)
find_package(PythonLibs 2.7 REQUIRED)
find_package(PythonInterp 2.7 REQUIRED)
find_package(PythonLibs 3.4 REQUIRED)
find_package(PythonInterp 3.4 REQUIRED)
endmacro()


macro(setup_qt)
set(DD_QT_VERSION 4 CACHE STRING "Selected Qt version")
get_ubuntu_version()

set(_default_qt_version 4)
if (ubuntu_version EQUAL 18.04)
set(_default_qt_version 5)
endif()

set(DD_QT_VERSION ${_default_qt_version} CACHE STRING "Selected Qt version")
set_property(CACHE DD_QT_VERSION PROPERTY STRINGS 4 5)

if(NOT (DD_QT_VERSION VERSION_EQUAL 4 OR DD_QT_VERSION VERSION_EQUAL 5))
Expand Down Expand Up @@ -87,6 +94,23 @@ macro(use_cpp11)
endmacro()


macro(get_ubuntu_version)
find_program(LSB_RELEASE lsb_release)
mark_as_advanced(LSB_RELEASE)
set(ubuntu_version)
if(LSB_RELEASE)
execute_process(COMMAND ${LSB_RELEASE} -is
OUTPUT_VARIABLE osname
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(osname STREQUAL Ubuntu)
execute_process(COMMAND ${LSB_RELEASE} -rs
OUTPUT_VARIABLE ubuntu_version
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
endif()
endmacro()


macro(use_pkg target)

find_package(PkgConfig REQUIRED)
Expand Down
4 changes: 2 additions & 2 deletions cmake/modules/FindNumPy.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@

# Finding NumPy involves calling the Python interpreter
if(NumPy_FIND_REQUIRED)
find_package(PythonInterp 2.7 REQUIRED)
find_package(PythonInterp 3.4 REQUIRED)
else()
find_package(PythonInterp 2.7)
find_package(PythonInterp 3.4)
endif()

if(NOT PYTHONINTERP_FOUND)
Expand Down
2 changes: 1 addition & 1 deletion distro/package/bundle_template.app/Contents/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundleLongVersionString</key>
<string></string>
<key>CFBundleName</key>
<string>Drake Visualizer</string>
<string>Director</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

cd "$(dirname "$0")"
./bin/drake-visualizer
./bin/directorPython -m director.mainwindowapp
49 changes: 25 additions & 24 deletions distro/package/fixup_mach_o.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import os
import sys
import subprocess
import commands
import subprocess
import re
import shutil

def findMachOFiles(searchPath, recursive=True):
maxDepthArg = '-maxdepth 1' if not recursive else ''
filenames = commands.getoutput('find "%s" %s -exec file {} \;| grep Mach-O | sed "s/:.*//"' % (searchPath, maxDepthArg)).splitlines()
filenames = subprocess.getoutput('find "%s" %s -exec file {} \;| grep Mach-O | sed "s/:.*//"' % (searchPath, maxDepthArg)).splitlines()
return filenames


def findDependencies(filename):
filenames = commands.getoutput('otool -l "%s" | grep " name" | sort | uniq | sed -e "s/ *name //g" | grep -v "@" | sed "s/ (offset.*)//"' % filename).splitlines()
filenames = subprocess.getoutput('otool -l "%s" | grep " name" | sort | uniq | sed -e "s/ *name //g" | grep -v "@" | sed "s/ (offset.*)//"' % filename).splitlines()

if 'executable' not in getMachOType(filename):
try:
Expand All @@ -27,12 +27,12 @@ def findDependencies(filename):


def getMachOType(filename):
return commands.getoutput('file "%s" | sed "s/.*: //"' % filename)
return subprocess.getoutput('file "%s" | sed "s/.*: //"' % filename)


def getMachOId(filename):

output = commands.getoutput('otool -D %s' % filename)
output = subprocess.getoutput('otool -D %s' % filename)
match = re.match('[^:]+:\s*([^\s]+)', output)
if not match:
raise RuntimeError('Could not determine id for %s' % filename)
Expand Down Expand Up @@ -76,7 +76,7 @@ def copyToDirectory(self, directory):
destDir = os.path.join(directory, m.group(2))

if not os.path.isdir(destDir):
print ' --> copy:', frameworkDir, destDir
print(' --> copy:', frameworkDir, destDir)
shutil.copytree(frameworkDir, destDir, symlinks=True)
self.copied = True

Expand All @@ -92,7 +92,7 @@ def copyToDirectory(self, directory):
self.new_path = self.new_realpath

if not os.path.isfile(self.new_realpath):
print ' --> copy:', self.old_realpath, self.new_realpath
print(' --> copy:', self.old_realpath, self.new_realpath)
shutil.copy(self.old_realpath, self.new_realpath)
self.copied = True

Expand All @@ -102,8 +102,8 @@ def copyToDirectory(self, directory):


def _changeId(self):
commands.getoutput('chmod u+w "%s"' % self.new_realpath)
commands.getoutput('install_name_tool -id "%s" "%s"' % (self.new_id, self.new_realpath))
subprocess.getoutput('chmod u+w "%s"' % self.new_realpath)
subprocess.getoutput('install_name_tool -id "%s" "%s"' % (self.new_id, self.new_realpath))
#commands.getoutput('chmod a-w "%s"' % filedest)


Expand All @@ -116,8 +116,8 @@ def resolveDependencyName(dep, libraryDir):

depInLibDir = os.path.join(buildDir, 'lib', dep)

print ' dep name is not file:', dep
print ' trying depInLibDir:', depInLibDir
print(' dep name is not file:', dep)
print(' trying depInLibDir:', depInLibDir)

if os.path.isfile(depInLibDir):
return depInLibDir
Expand All @@ -133,7 +133,7 @@ def scan(packageDir, libraryDir, processed, excludedDeps, excludeFunc):
for filename in files:

if not os.path.isfile(filename):
print 'warning, skipping unexpected mach-o file:', filename
print('warning, skipping unexpected mach-o file:', filename)
continue

filename = os.path.realpath(filename)
Expand All @@ -143,7 +143,7 @@ def scan(packageDir, libraryDir, processed, excludedDeps, excludeFunc):

processed.add(filename)

print 'processing:', filename
print('processing:', filename)

deps = findDependencies(filename)

Expand All @@ -153,7 +153,7 @@ def scan(packageDir, libraryDir, processed, excludedDeps, excludeFunc):

dep = resolveDependencyName(dep, libraryDir)
if not os.path.isfile(dep):
print ' warning, skipping dependency not found:', dep
print(' warning, skipping dependency not found:', dep)
raise Exception()
continue

Expand All @@ -164,9 +164,9 @@ def scan(packageDir, libraryDir, processed, excludedDeps, excludeFunc):
dep = Dependency(dep)


print ' dep:', dep.old_path
print(' dep:', dep.old_path)
if dep.old_path != dep.old_realpath:
print ' realpath:', dep.old_realpath
print(' realpath:', dep.old_realpath)


dep.copyToDirectory(libraryDir)
Expand All @@ -178,7 +178,7 @@ def scan(packageDir, libraryDir, processed, excludedDeps, excludeFunc):
relativePathToDependency = os.path.relpath(dep.new_realpath, os.path.dirname(filename))
newInstallName = '@loader_path/' + relativePathToDependency

print ' new relative name:', newInstallName
print(' new relative name:', newInstallName)

for old in (dep.old_path, dep.old_realpath, dep.old_id):
installNameChanges.append((old, newInstallName))
Expand All @@ -189,10 +189,10 @@ def scan(packageDir, libraryDir, processed, excludedDeps, excludeFunc):
#for arg in installNameArgs:
# print ' ', arg

commands.getoutput('chmod u+w "%s"' % filename)
commands.getoutput('install_name_tool %s "%s"' % (' '.join(installNameArgs), filename))
subprocess.getoutput('chmod u+w "%s"' % filename)
subprocess.getoutput('install_name_tool %s "%s"' % (' '.join(installNameArgs), filename))
relativePathToLibraryDir = os.path.relpath(libraryDir, os.path.dirname(filename))
commands.getoutput('install_name_tool -add_rpath "@loader_path/%s" "%s"' % (relativePathToLibraryDir, filename))
subprocess.getoutput('install_name_tool -add_rpath "@loader_path/%s" "%s"' % (relativePathToLibraryDir, filename))

return numCopied

Expand All @@ -210,7 +210,8 @@ def main():
assert os.path.isdir(libraryDir)
assert '..' not in os.path.relpath(libraryDir, packageDir)

prefixes = [os.path.realpath(buildDir), '/usr/local']
#prefixes = [os.path.realpath(buildDir), '/usr/local']
prefixes = [os.path.realpath(buildDir)]

def isExcluded(filename):
for prefix in prefixes:
Expand All @@ -228,10 +229,10 @@ def isExcluded(filename):


excludedDeps = sorted(list(excludedDeps))
print
print 'other dependencies:'
print()
print('other dependencies:')
for filename in excludedDeps:
print filename
print(filename)


if __name__ == '__main__':
Expand Down
17 changes: 8 additions & 9 deletions distro/package/make_mac_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,19 @@ mkdir -p $superbuildInstallDir/share

cp -r $superbuildInstallDir/{bin,lib,include,share} $bundleDir/Contents/MacOS/
cp $(which python) $binDir/
touch $binDir/qt.conf
#touch $binDir/qt.conf

mkdir -p $sitePackagesDir
cp -r /usr/local/opt/vtk7/lib/python${pythonVersion}/site-packages/vtk $sitePackagesDir/
cp -r /usr/local/lib/python${pythonVersion}/site-packages/numpy $sitePackagesDir/
cp -r /usr/local/lib/python${pythonVersion}/site-packages/scipy $sitePackagesDir/
cp -r /usr/local/lib/python${pythonVersion}/site-packages/yaml $sitePackagesDir/
cp -r /usr/local/lib/python${pythonVersion}/site-packages/lxml $sitePackagesDir/
#cp -r /usr/local/lib/python${pythonVersion}/site-packages/vtk* $sitePackagesDir/
#cp -r /usr/local/lib/python${pythonVersion}/site-packages/numpy $sitePackagesDir/
#cp -r /usr/local/lib/python${pythonVersion}/site-packages/scipy $sitePackagesDir/
#cp -r /usr/local/lib/python${pythonVersion}/site-packages/yaml $sitePackagesDir/
#cp -r /usr/local/lib/python${pythonVersion}/site-packages/lxml $sitePackagesDir/


python $scriptDir/fixup_mach_o.py $superbuildInstallDir $bundleDir $libDir
python3 $scriptDir/fixup_mach_o.py $superbuildInstallDir $bundleDir $libDir

# remove broken symlink to homebrew python site-packages
rm $libDir/Python.framework/Versions/Current/lib/python${pythonVersion}/site-packages
#rm $libDir/Python.framework/Versions/${pythonVersion}/lib/python${pythonVersion}/site-packages

cd $scriptDir
mkdir $packageName
Expand Down
Loading

0 comments on commit 7139b80

Please sign in to comment.