Skip to content

Commit

Permalink
Added xcode
Browse files Browse the repository at this point in the history
Added find_rez_headers(), and build_rez(). Updated doxygen to 1.12
  • Loading branch information
burgerbecky committed Aug 26, 2024
1 parent a2e3c2a commit 7920624
Show file tree
Hide file tree
Showing 8 changed files with 625 additions and 320 deletions.
12 changes: 8 additions & 4 deletions burger/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
is_codewarrior_mac_allowed, import_py_script, run_py_script, \
execfile

from .locators import where_is_xcode, where_is_codeblocks, where_is_watcom, \
from .locators import where_is_codeblocks, where_is_watcom, \
where_is_doxygen, where_is_visual_studio

from .perforce import where_is_p4, is_under_p4_control, perforce_command, \
Expand All @@ -114,6 +114,8 @@

from .windowsutils import find_visual_studios

from .xcode import where_is_xcode, find_rez_headers, build_rez

if PY2:
from cStringIO import StringIO
else:
Expand All @@ -123,7 +125,7 @@


# Numeric version
__numversion__ = (1, 3, 1)
__numversion__ = (1, 4, 0)

# Current version of the library
__version__ = ".".join([str(num) for num in __numversion__])
Expand Down Expand Up @@ -209,7 +211,6 @@
"import_py_script",
"run_py_script",
"execfile",
"where_is_xcode",
"where_is_codeblocks",
"where_is_watcom",
"where_is_doxygen",
Expand All @@ -235,7 +236,10 @@
"StringListProperty",
"EnumProperty",
"NoneProperty",
"find_visual_studios"
"find_visual_studios",
"where_is_xcode",
"find_rez_headers",
"build_rez"
]

########################################
Expand Down
119 changes: 3 additions & 116 deletions burger/locators.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
except ImportError:
pass

from .strutils import PY3_4_OR_HIGHER, get_mac_host_type, get_windows_host_type, \
from .strutils import get_mac_host_type, get_windows_host_type, \
IS_LINUX, convert_to_windows_slashes

from .buildutils import is_exe, find_in_path, _WINDOWS_ENV_PATHS
Expand Down Expand Up @@ -81,120 +81,6 @@
########################################


def where_is_xcode(xcode_version=None):
"""
Locate xcodebuild for a specific version of XCode.
Given a specific version by version, scan the locations that the IDE would
be found.
Example:
>>> burger.where_is_xcode()
("/Developer/usr/bin/xcodebuild", 3)
>>> burger.where_is_xcode(2093)
None
Note:
This function will always return None on non-macOS hosts.
Minimum version of XCode is 3.
Args:
xcode_version: Version number
Returns:
Path to xcodebuild for the XCode version or None.
"""

# pylint: disable=too-many-branches

# Test if running on a mac host
host_type = get_mac_host_type()
if not host_type:
return None

# Only import on macosx hosts
# pylint: disable=import-outside-toplevel
import plistlib

# XCode 5 and higher reside in the app folder
highest_version = 0
xcodebuild = None

# Version 3 and 4 is in /Developer while all
# others are in /Applications

dir_list = []
if xcode_version is None or xcode_version < 5:
dir_list.append("/Developer/Applications")
if xcode_version is None or xcode_version > 3:
dir_list.append("/Applications")

for base_dir in dir_list:
# Check if the directory exists first
if os.path.isdir(base_dir):

# Scan the applications folder for all apps called "XCode"
for item in os.listdir(base_dir):

# Scan only apps whose name starts with xcode
if not item.lower().startswith("xcode"):
continue

temp_path = base_dir + "/" + item + "/Contents/version.plist"
try:
# pylint: disable=no-member
if PY3_4_OR_HIGHER:
with open(temp_path, "rb") as filefp:
version_dict = plistlib.load(filefp)
else:
version_dict = plistlib.readPlist(
temp_path)

# Any IO error is acceptable to ignore
except IOError:
continue

version = version_dict.get("CFBundleShortVersionString", None)
if not version:
continue

# Check the version for a match
version = int(version.split(".")[0])

# XCode 3 is hard coded to Developer
if version == 3:
temp_path = "/Developer/usr/bin/xcodebuild"
else:
temp_path = (
"{}/{}/Contents/Developer"
"/usr/bin/xcodebuild").format(base_dir, item)

if not os.path.isfile(temp_path):
continue

if xcode_version:
# If scanning for a perfect match, exit if found
if version == xcode_version:
highest_version = version
return (temp_path, version)

# Scan for the most recent version of XCode
elif version > highest_version:
highest_version = version
xcodebuild = (temp_path, version)

# XCode 3 is hard coded to a specific location
if (not xcode_version and not highest_version) or xcode_version == 3:
# On OSX Lion and higher, XCode 3.1.4 is a separate folder
for item in ("/Xcode3.1.4/usr/bin/xcodebuild",):
if os.path.isfile(item):
xcodebuild = (item, 3)
break

return xcodebuild

########################################


def _get_codeblocks_registry_path():
"""
Locate codeblocks path using the Window Registry
Expand Down Expand Up @@ -614,7 +500,8 @@ def where_is_visual_studio(vs_version, tool_name=None, cpu=None):
Examples:
>>> burger.where_is_visual_studio(2010)
"C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\Common7\\ide\\devenv.com"
"C:\\Program Files (x86)\\Microsoft Visual Studio 10.0"
"\\Common7\\ide\\devenv.com"
Args:
vs_version: Version year as number
Expand Down
Loading

0 comments on commit 7920624

Please sign in to comment.