MCPcopy Index your code
hub / github.com/python/cpython / setIcon

Function setIcon

Mac/BuildScript/build-installer.py:1692–1709  ·  view source on GitHub ↗

Set the custom icon for the specified file or directory.

(filePath, icnsPath)

Source from the content-addressed store, hash-verified

1690
1691
1692def setIcon(filePath, icnsPath):
1693 """
1694 Set the custom icon for the specified file or directory.
1695 """
1696
1697 dirPath = os.path.normpath(os.path.dirname(__file__))
1698 toolPath = os.path.join(dirPath, "seticon.app/Contents/MacOS/seticon")
1699 if not os.path.exists(toolPath) or os.stat(toolPath).st_mtime < os.stat(dirPath + '/seticon.m').st_mtime:
1700 # NOTE: The tool is created inside an .app bundle, otherwise it won't work due
1701 # to connections to the window server.
1702 appPath = os.path.join(dirPath, "seticon.app/Contents/MacOS")
1703 if not os.path.exists(appPath):
1704 os.makedirs(appPath)
1705 runCommand("cc -o %s %s/seticon.m -framework Cocoa"%(
1706 shellQuote(toolPath), shellQuote(dirPath)))
1707
1708 runCommand("%s %s %s"%(shellQuote(os.path.abspath(toolPath)), shellQuote(icnsPath),
1709 shellQuote(filePath)))
1710
1711def main():
1712 # First parse options and check if we can perform our work

Callers 2

buildDMGFunction · 0.85
mainFunction · 0.85

Calls 7

runCommandFunction · 0.85
shellQuoteFunction · 0.85
dirnameMethod · 0.45
joinMethod · 0.45
existsMethod · 0.45
statMethod · 0.45
abspathMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…