Commits

Ronald Oussoren committed aa1c146

Port to py3k

Comments (0)

Files changed (10)

pyobjc-framework-LaunchServices/Lib/LaunchServices/__init__.py

 _objc.loadBundleFunctions(
         __bundle__, globals(),
         [
-            ('_LSCopyAllApplicationURLs', 'v^@', '', { 'arguments': { 0: { 'already_retained': True, 'type_modifier': 'o',  } } } ),
+            ('_LSCopyAllApplicationURLs', b'v^@', '', { 'arguments': { 0: { 'already_retained': True, 'type_modifier': 'o',  } } } ),
         ])

pyobjc-framework-LaunchServices/PyObjCTest/test_iconscore.py

 
 class TestIconsCore (TestCase):
     def testConstants(self):
-        self.failUnlessEqual(kGenericDocumentIconResource, -4000)
-        self.failUnlessEqual(kGenericStationeryIconResource, -3985)
-        self.failUnlessEqual(kGenericEditionFileIconResource, -3989)
-        self.failUnlessEqual(kGenericApplicationIconResource, -3996)
-        self.failUnlessEqual(kGenericDeskAccessoryIconResource, -3991)
-        self.failUnlessEqual(kGenericFolderIconResource, -3999)
-        self.failUnlessEqual(kPrivateFolderIconResource, -3994)
-        self.failUnlessEqual(kFloppyIconResource, -3998)
-        self.failUnlessEqual(kTrashIconResource, -3993)
-        self.failUnlessEqual(kGenericRAMDiskIconResource, -3988)
-        self.failUnlessEqual(kGenericCDROMIconResource, -3987)
-        self.failUnlessEqual(kDesktopIconResource, -3992)
-        self.failUnlessEqual(kOpenFolderIconResource, -3997)
-        self.failUnlessEqual(kGenericHardDiskIconResource, -3995)
-        self.failUnlessEqual(kGenericFileServerIconResource, -3972)
-        self.failUnlessEqual(kGenericSuitcaseIconResource, -3970)
-        self.failUnlessEqual(kGenericMoverObjectIconResource, -3969)
+        self.assertEqual(kGenericDocumentIconResource, -4000)
+        self.assertEqual(kGenericStationeryIconResource, -3985)
+        self.assertEqual(kGenericEditionFileIconResource, -3989)
+        self.assertEqual(kGenericApplicationIconResource, -3996)
+        self.assertEqual(kGenericDeskAccessoryIconResource, -3991)
+        self.assertEqual(kGenericFolderIconResource, -3999)
+        self.assertEqual(kPrivateFolderIconResource, -3994)
+        self.assertEqual(kFloppyIconResource, -3998)
+        self.assertEqual(kTrashIconResource, -3993)
+        self.assertEqual(kGenericRAMDiskIconResource, -3988)
+        self.assertEqual(kGenericCDROMIconResource, -3987)
+        self.assertEqual(kDesktopIconResource, -3992)
+        self.assertEqual(kOpenFolderIconResource, -3997)
+        self.assertEqual(kGenericHardDiskIconResource, -3995)
+        self.assertEqual(kGenericFileServerIconResource, -3972)
+        self.assertEqual(kGenericSuitcaseIconResource, -3970)
+        self.assertEqual(kGenericMoverObjectIconResource, -3969)
         
-        self.failUnlessEqual(kGenericPreferencesIconResource, -3971)
-        self.failUnlessEqual(kGenericQueryDocumentIconResource, -16506)
-        self.failUnlessEqual(kGenericExtensionIconResource, -16415)
-        self.failUnlessEqual(kSystemFolderIconResource, -3983)
-        self.failUnlessEqual(kHelpIconResource, -20271)
-        self.failUnlessEqual(kAppleMenuFolderIconResource, -3982)
-        self.failUnlessEqual(genericDocumentIconResource, kGenericDocumentIconResource)
-        self.failUnlessEqual(genericStationeryIconResource, kGenericStationeryIconResource)
-        self.failUnlessEqual(genericEditionFileIconResource, kGenericEditionFileIconResource)
-        self.failUnlessEqual(genericApplicationIconResource, kGenericApplicationIconResource)
-        self.failUnlessEqual(genericDeskAccessoryIconResource, kGenericDeskAccessoryIconResource)
-        self.failUnlessEqual(genericFolderIconResource, kGenericFolderIconResource)
-        self.failUnlessEqual(privateFolderIconResource, kPrivateFolderIconResource)
-        self.failUnlessEqual(floppyIconResource, kFloppyIconResource)
-        self.failUnlessEqual(trashIconResource, kTrashIconResource)
-        self.failUnlessEqual(genericRAMDiskIconResource, kGenericRAMDiskIconResource)
-        self.failUnlessEqual(genericCDROMIconResource, kGenericCDROMIconResource)
-        self.failUnlessEqual(desktopIconResource, kDesktopIconResource)
-        self.failUnlessEqual(openFolderIconResource, kOpenFolderIconResource)
-        self.failUnlessEqual(genericHardDiskIconResource, kGenericHardDiskIconResource)
-        self.failUnlessEqual(genericFileServerIconResource, kGenericFileServerIconResource)
-        self.failUnlessEqual(genericSuitcaseIconResource, kGenericSuitcaseIconResource)
-        self.failUnlessEqual(genericMoverObjectIconResource, kGenericMoverObjectIconResource)
-        self.failUnlessEqual(genericPreferencesIconResource, kGenericPreferencesIconResource)
-        self.failUnlessEqual(genericQueryDocumentIconResource, kGenericQueryDocumentIconResource)
-        self.failUnlessEqual(genericExtensionIconResource, kGenericExtensionIconResource)
-        self.failUnlessEqual(systemFolderIconResource, kSystemFolderIconResource)
-        self.failUnlessEqual(appleMenuFolderIconResource, kAppleMenuFolderIconResource)
-        self.failUnlessEqual(kStartupFolderIconResource, -3981)
-        self.failUnlessEqual(kOwnedFolderIconResource, -3980)
-        self.failUnlessEqual(kDropFolderIconResource, -3979)
-        self.failUnlessEqual(kSharedFolderIconResource, -3978)
-        self.failUnlessEqual(kMountedFolderIconResource, -3977)
-        self.failUnlessEqual(kControlPanelFolderIconResource, -3976)
-        self.failUnlessEqual(kPrintMonitorFolderIconResource, -3975)
-        self.failUnlessEqual(kPreferencesFolderIconResource, -3974)
-        self.failUnlessEqual(kExtensionsFolderIconResource, -3973)
-        self.failUnlessEqual(kFontsFolderIconResource, -3968)
-        self.failUnlessEqual(kFullTrashIconResource, -3984)
-        self.failUnlessEqual(startupFolderIconResource, kStartupFolderIconResource)
-        self.failUnlessEqual(ownedFolderIconResource, kOwnedFolderIconResource)
-        self.failUnlessEqual(dropFolderIconResource, kDropFolderIconResource)
-        self.failUnlessEqual(sharedFolderIconResource, kSharedFolderIconResource)
-        self.failUnlessEqual(mountedFolderIconResource, kMountedFolderIconResource)
-        self.failUnlessEqual(controlPanelFolderIconResource, kControlPanelFolderIconResource)
-        self.failUnlessEqual(printMonitorFolderIconResource, kPrintMonitorFolderIconResource)
-        self.failUnlessEqual(preferencesFolderIconResource, kPreferencesFolderIconResource)
-        self.failUnlessEqual(extensionsFolderIconResource, kExtensionsFolderIconResource)
-        self.failUnlessEqual(fontsFolderIconResource, kFontsFolderIconResource)
-        self.failUnlessEqual(fullTrashIconResource, kFullTrashIconResource)
-        self.failUnlessEqual(kSystemIconsCreator, fourcc('macs'))
+        self.assertEqual(kGenericPreferencesIconResource, -3971)
+        self.assertEqual(kGenericQueryDocumentIconResource, -16506)
+        self.assertEqual(kGenericExtensionIconResource, -16415)
+        self.assertEqual(kSystemFolderIconResource, -3983)
+        self.assertEqual(kHelpIconResource, -20271)
+        self.assertEqual(kAppleMenuFolderIconResource, -3982)
+        self.assertEqual(genericDocumentIconResource, kGenericDocumentIconResource)
+        self.assertEqual(genericStationeryIconResource, kGenericStationeryIconResource)
+        self.assertEqual(genericEditionFileIconResource, kGenericEditionFileIconResource)
+        self.assertEqual(genericApplicationIconResource, kGenericApplicationIconResource)
+        self.assertEqual(genericDeskAccessoryIconResource, kGenericDeskAccessoryIconResource)
+        self.assertEqual(genericFolderIconResource, kGenericFolderIconResource)
+        self.assertEqual(privateFolderIconResource, kPrivateFolderIconResource)
+        self.assertEqual(floppyIconResource, kFloppyIconResource)
+        self.assertEqual(trashIconResource, kTrashIconResource)
+        self.assertEqual(genericRAMDiskIconResource, kGenericRAMDiskIconResource)
+        self.assertEqual(genericCDROMIconResource, kGenericCDROMIconResource)
+        self.assertEqual(desktopIconResource, kDesktopIconResource)
+        self.assertEqual(openFolderIconResource, kOpenFolderIconResource)
+        self.assertEqual(genericHardDiskIconResource, kGenericHardDiskIconResource)
+        self.assertEqual(genericFileServerIconResource, kGenericFileServerIconResource)
+        self.assertEqual(genericSuitcaseIconResource, kGenericSuitcaseIconResource)
+        self.assertEqual(genericMoverObjectIconResource, kGenericMoverObjectIconResource)
+        self.assertEqual(genericPreferencesIconResource, kGenericPreferencesIconResource)
+        self.assertEqual(genericQueryDocumentIconResource, kGenericQueryDocumentIconResource)
+        self.assertEqual(genericExtensionIconResource, kGenericExtensionIconResource)
+        self.assertEqual(systemFolderIconResource, kSystemFolderIconResource)
+        self.assertEqual(appleMenuFolderIconResource, kAppleMenuFolderIconResource)
+        self.assertEqual(kStartupFolderIconResource, -3981)
+        self.assertEqual(kOwnedFolderIconResource, -3980)
+        self.assertEqual(kDropFolderIconResource, -3979)
+        self.assertEqual(kSharedFolderIconResource, -3978)
+        self.assertEqual(kMountedFolderIconResource, -3977)
+        self.assertEqual(kControlPanelFolderIconResource, -3976)
+        self.assertEqual(kPrintMonitorFolderIconResource, -3975)
+        self.assertEqual(kPreferencesFolderIconResource, -3974)
+        self.assertEqual(kExtensionsFolderIconResource, -3973)
+        self.assertEqual(kFontsFolderIconResource, -3968)
+        self.assertEqual(kFullTrashIconResource, -3984)
+        self.assertEqual(startupFolderIconResource, kStartupFolderIconResource)
+        self.assertEqual(ownedFolderIconResource, kOwnedFolderIconResource)
+        self.assertEqual(dropFolderIconResource, kDropFolderIconResource)
+        self.assertEqual(sharedFolderIconResource, kSharedFolderIconResource)
+        self.assertEqual(mountedFolderIconResource, kMountedFolderIconResource)
+        self.assertEqual(controlPanelFolderIconResource, kControlPanelFolderIconResource)
+        self.assertEqual(printMonitorFolderIconResource, kPrintMonitorFolderIconResource)
+        self.assertEqual(preferencesFolderIconResource, kPreferencesFolderIconResource)
+        self.assertEqual(extensionsFolderIconResource, kExtensionsFolderIconResource)
+        self.assertEqual(fontsFolderIconResource, kFontsFolderIconResource)
+        self.assertEqual(fullTrashIconResource, kFullTrashIconResource)
+        self.assertEqual(kSystemIconsCreator, fourcc(b'macs'))
 
-        self.failUnlessEqual(kClipboardIcon, fourcc('CLIP'))
-        self.failUnlessEqual(kClippingUnknownTypeIcon, fourcc('clpu'))
-        self.failUnlessEqual(kClippingPictureTypeIcon, fourcc('clpp'))
-        self.failUnlessEqual(kClippingTextTypeIcon, fourcc('clpt'))
-        self.failUnlessEqual(kClippingSoundTypeIcon, fourcc('clps'))
-        self.failUnlessEqual(kDesktopIcon, fourcc('desk'))
-        self.failUnlessEqual(kFinderIcon, fourcc('FNDR'))
-        self.failUnlessEqual(kComputerIcon, fourcc('root'))
-        self.failUnlessEqual(kFontSuitcaseIcon, fourcc('FFIL'))
-        self.failUnlessEqual(kFullTrashIcon, fourcc('ftrh'))
-        self.failUnlessEqual(kGenericApplicationIcon, fourcc('APPL'))
-        self.failUnlessEqual(kGenericCDROMIcon, fourcc('cddr'))
-        self.failUnlessEqual(kGenericControlPanelIcon, fourcc('APPC'))
-        self.failUnlessEqual(kGenericControlStripModuleIcon, fourcc('sdev'))
-        self.failUnlessEqual(kGenericComponentIcon, fourcc('thng'))
-        self.failUnlessEqual(kGenericDeskAccessoryIcon, fourcc('APPD'))
-        self.failUnlessEqual(kGenericDocumentIcon, fourcc('docu'))
-        self.failUnlessEqual(kGenericEditionFileIcon, fourcc('edtf'))
-        self.failUnlessEqual(kGenericExtensionIcon, fourcc('INIT'))
-        self.failUnlessEqual(kGenericFileServerIcon, fourcc('srvr'))
-        self.failUnlessEqual(kGenericFontIcon, fourcc('ffil'))
-        self.failUnlessEqual(kGenericFontScalerIcon, fourcc('sclr'))
-        self.failUnlessEqual(kGenericFloppyIcon, fourcc('flpy'))
-        self.failUnlessEqual(kGenericHardDiskIcon, fourcc('hdsk'))
-        self.failUnlessEqual(kGenericIDiskIcon, fourcc('idsk'))
-        self.failUnlessEqual(kGenericRemovableMediaIcon, fourcc('rmov'))
-        self.failUnlessEqual(kGenericMoverObjectIcon, fourcc('movr'))
-        self.failUnlessEqual(kGenericPCCardIcon, fourcc('pcmc'))
-        self.failUnlessEqual(kGenericPreferencesIcon, fourcc('pref'))
-        self.failUnlessEqual(kGenericQueryDocumentIcon, fourcc('qery'))
-        self.failUnlessEqual(kGenericRAMDiskIcon, fourcc('ramd'))
-        self.failUnlessEqual(kGenericSharedLibaryIcon, fourcc('shlb'))
-        self.failUnlessEqual(kGenericStationeryIcon, fourcc('sdoc'))
-        self.failUnlessEqual(kGenericSuitcaseIcon, fourcc('suit'))
-        self.failUnlessEqual(kGenericURLIcon, fourcc('gurl'))
-        self.failUnlessEqual(kGenericWORMIcon, fourcc('worm'))
-        self.failUnlessEqual(kInternationalResourcesIcon, fourcc('ifil'))
-        self.failUnlessEqual(kKeyboardLayoutIcon, fourcc('kfil'))
-        self.failUnlessEqual(kSoundFileIcon, fourcc('sfil'))
-        self.failUnlessEqual(kSystemSuitcaseIcon, fourcc('zsys'))
-        self.failUnlessEqual(kTrashIcon, fourcc('trsh'))
-        self.failUnlessEqual(kTrueTypeFontIcon, fourcc('tfil'))
-        self.failUnlessEqual(kTrueTypeFlatFontIcon, fourcc('sfnt'))
-        self.failUnlessEqual(kTrueTypeMultiFlatFontIcon, fourcc('ttcf'))
-        self.failUnlessEqual(kUserIDiskIcon, fourcc('udsk'))
-        self.failUnlessEqual(kUnknownFSObjectIcon, fourcc('unfs'))
-        self.failUnlessEqual(kInternationResourcesIcon, kInternationalResourcesIcon)
-        self.failUnlessEqual(kInternetLocationHTTPIcon, fourcc('ilht'))
-        self.failUnlessEqual(kInternetLocationFTPIcon, fourcc('ilft'))
-        self.failUnlessEqual(kInternetLocationAppleShareIcon, fourcc('ilaf'))
-        self.failUnlessEqual(kInternetLocationAppleTalkZoneIcon, fourcc('ilat'))
-        self.failUnlessEqual(kInternetLocationFileIcon, fourcc('ilfi'))
-        self.failUnlessEqual(kInternetLocationMailIcon, fourcc('ilma'))
-        self.failUnlessEqual(kInternetLocationNewsIcon, fourcc('ilnw'))
-        self.failUnlessEqual(kInternetLocationNSLNeighborhoodIcon, fourcc('ilns'))
-        self.failUnlessEqual(kInternetLocationGenericIcon, fourcc('ilge'))
-        self.failUnlessEqual(kGenericFolderIcon, fourcc('fldr'))
-        self.failUnlessEqual(kDropFolderIcon, fourcc('dbox'))
-        self.failUnlessEqual(kMountedFolderIcon, fourcc('mntd'))
-        self.failUnlessEqual(kOpenFolderIcon, fourcc('ofld'))
-        self.failUnlessEqual(kOwnedFolderIcon, fourcc('ownd'))
-        self.failUnlessEqual(kPrivateFolderIcon, fourcc('prvf'))
-        self.failUnlessEqual(kSharedFolderIcon, fourcc('shfl'))
-        self.failUnlessEqual(kSharingPrivsNotApplicableIcon, fourcc('shna'))
-        self.failUnlessEqual(kSharingPrivsReadOnlyIcon, fourcc('shro'))
-        self.failUnlessEqual(kSharingPrivsReadWriteIcon, fourcc('shrw'))
-        self.failUnlessEqual(kSharingPrivsUnknownIcon, fourcc('shuk'))
-        self.failUnlessEqual(kSharingPrivsWritableIcon, fourcc('writ'))
-        self.failUnlessEqual(kUserFolderIcon, fourcc('ufld'))
-        self.failUnlessEqual(kWorkgroupFolderIcon, fourcc('wfld'))
-        self.failUnlessEqual(kGuestUserIcon, fourcc('gusr'))
-        self.failUnlessEqual(kUserIcon, fourcc('user'))
-        self.failUnlessEqual(kOwnerIcon, fourcc('susr'))
-        self.failUnlessEqual(kGroupIcon, fourcc('grup'))
-        self.failUnlessEqual(kAppearanceFolderIcon, fourcc('appr'))
-        self.failUnlessEqual(kAppleExtrasFolderIcon, cast_int(0x616578C4))
-        self.failUnlessEqual(kAppleMenuFolderIcon, fourcc('amnu'))
-        self.failUnlessEqual(kApplicationsFolderIcon, fourcc('apps'))
-        self.failUnlessEqual(kApplicationSupportFolderIcon, fourcc('asup'))
-        self.failUnlessEqual(kAssistantsFolderIcon, cast_int(0x617374C4))
-        self.failUnlessEqual(kColorSyncFolderIcon, fourcc('prof'))
-        self.failUnlessEqual(kContextualMenuItemsFolderIcon, fourcc('cmnu'))
-        self.failUnlessEqual(kControlPanelDisabledFolderIcon, fourcc('ctrD'))
-        self.failUnlessEqual(kControlPanelFolderIcon, fourcc('ctrl'))
-        self.failUnlessEqual(kControlStripModulesFolderIcon, cast_int(0x736476C4))
-        self.failUnlessEqual(kDocumentsFolderIcon, fourcc('docs'))
-        self.failUnlessEqual(kExtensionsDisabledFolderIcon, fourcc('extD'))
-        self.failUnlessEqual(kExtensionsFolderIcon, fourcc('extn'))
-        self.failUnlessEqual(kFavoritesFolderIcon, fourcc('favs'))
-        self.failUnlessEqual(kFontsFolderIcon, fourcc('font'))
-        self.failUnlessEqual(kHelpFolderIcon, cast_int(0xC4686C70))
-        self.failUnlessEqual(kInternetFolderIcon, cast_int(0x696E74C4))
-        self.failUnlessEqual(kInternetPlugInFolderIcon, cast_int(0xC46E6574))
-        self.failUnlessEqual(kInternetSearchSitesFolderIcon, fourcc('issf'))
-        self.failUnlessEqual(kLocalesFolderIcon, cast_int(0xC46C6F63))
-        self.failUnlessEqual(kMacOSReadMeFolderIcon, cast_int(0x6D6F72C4))
-        self.failUnlessEqual(kPublicFolderIcon, fourcc('pubf'))
-        self.failUnlessEqual(kPreferencesFolderIcon, cast_int(0x707266C4))
-        self.failUnlessEqual(kPrinterDescriptionFolderIcon, fourcc('ppdf'))
-        self.failUnlessEqual(kPrinterDriverFolderIcon, cast_int(0xC4707264))
-        self.failUnlessEqual(kPrintMonitorFolderIcon, fourcc('prnt'))
-        self.failUnlessEqual(kRecentApplicationsFolderIcon, fourcc('rapp'))
-        self.failUnlessEqual(kRecentDocumentsFolderIcon, fourcc('rdoc'))
-        self.failUnlessEqual(kRecentServersFolderIcon, fourcc('rsrv'))
-        self.failUnlessEqual(kScriptingAdditionsFolderIcon, cast_int(0xC4736372))
-        self.failUnlessEqual(kSharedLibrariesFolderIcon, cast_int(0xC46C6962))
-        self.failUnlessEqual(kScriptsFolderIcon, cast_int( 0x736372C4))
-        self.failUnlessEqual(kShutdownItemsDisabledFolderIcon, fourcc('shdD'))
-        self.failUnlessEqual(kShutdownItemsFolderIcon, fourcc('shdf'))
-        self.failUnlessEqual(kSpeakableItemsFolder, fourcc('spki'))
-        self.failUnlessEqual(kStartupItemsDisabledFolderIcon, fourcc('strD'))
-        self.failUnlessEqual(kStartupItemsFolderIcon, fourcc('strt'))
-        self.failUnlessEqual(kSystemExtensionDisabledFolderIcon, fourcc('macD'))
-        self.failUnlessEqual(kSystemFolderIcon, fourcc('macs'))
-        self.failUnlessEqual(kTextEncodingsFolderIcon, cast_int(0xC4746578))
-        self.failUnlessEqual(kUsersFolderIcon, cast_int(0x757372C4))
-        self.failUnlessEqual(kUtilitiesFolderIcon, cast_int(0x757469C4))
-        self.failUnlessEqual(kVoicesFolderIcon, fourcc('fvoc'))
-        self.failUnlessEqual(kAppleScriptBadgeIcon, fourcc('scrp'))
-        self.failUnlessEqual(kLockedBadgeIcon, fourcc('lbdg'))
-        self.failUnlessEqual(kMountedBadgeIcon, fourcc('mbdg'))
-        self.failUnlessEqual(kSharedBadgeIcon, fourcc('sbdg'))
-        self.failUnlessEqual(kAliasBadgeIcon, fourcc('abdg'))
-        self.failUnlessEqual(kAlertCautionBadgeIcon, fourcc('cbdg'))
-        self.failUnlessEqual(kAlertNoteIcon, fourcc('note'))
-        self.failUnlessEqual(kAlertCautionIcon, fourcc('caut'))
-        self.failUnlessEqual(kAlertStopIcon, fourcc('stop'))
-        self.failUnlessEqual(kAppleTalkIcon, fourcc('atlk'))
-        self.failUnlessEqual(kAppleTalkZoneIcon, fourcc('atzn'))
-        self.failUnlessEqual(kAFPServerIcon, fourcc('afps'))
-        self.failUnlessEqual(kFTPServerIcon, fourcc('ftps'))
-        self.failUnlessEqual(kHTTPServerIcon, fourcc('htps'))
-        self.failUnlessEqual(kGenericNetworkIcon, fourcc('gnet'))
-        self.failUnlessEqual(kIPFileServerIcon, fourcc('isrv'))
-        self.failUnlessEqual(kToolbarCustomizeIcon, fourcc('tcus'))
-        self.failUnlessEqual(kToolbarDeleteIcon, fourcc('tdel'))
-        self.failUnlessEqual(kToolbarFavoritesIcon, fourcc('tfav'))
-        self.failUnlessEqual(kToolbarHomeIcon, fourcc('thom'))
-        self.failUnlessEqual(kAppleLogoIcon, fourcc('capl'))
-        self.failUnlessEqual(kAppleMenuIcon, fourcc('sapl'))
-        self.failUnlessEqual(kBackwardArrowIcon, fourcc('baro'))
-        self.failUnlessEqual(kFavoriteItemsIcon, fourcc('favr'))
-        self.failUnlessEqual(kForwardArrowIcon, fourcc('faro'))
-        self.failUnlessEqual(kGridIcon, fourcc('grid'))
-        self.failUnlessEqual(kHelpIcon, fourcc('help'))
-        self.failUnlessEqual(kKeepArrangedIcon, fourcc('arng'))
-        self.failUnlessEqual(kLockedIcon, fourcc('lock'))
-        self.failUnlessEqual(kNoFilesIcon, fourcc('nfil'))
-        self.failUnlessEqual(kNoFolderIcon, fourcc('nfld'))
-        self.failUnlessEqual(kNoWriteIcon, fourcc('nwrt'))
-        self.failUnlessEqual(kProtectedApplicationFolderIcon, fourcc('papp'))
-        self.failUnlessEqual(kProtectedSystemFolderIcon, fourcc('psys'))
-        self.failUnlessEqual(kRecentItemsIcon, fourcc('rcnt'))
-        self.failUnlessEqual(kShortcutIcon, fourcc('shrt'))
-        self.failUnlessEqual(kSortAscendingIcon, fourcc('asnd'))
-        self.failUnlessEqual(kSortDescendingIcon, fourcc('dsnd'))
-        self.failUnlessEqual(kUnlockedIcon, fourcc('ulck'))
-        self.failUnlessEqual(kConnectToIcon, fourcc('cnct'))
-        self.failUnlessEqual(kGenericWindowIcon, fourcc('gwin'))
-        self.failUnlessEqual(kQuestionMarkIcon, fourcc('ques'))
-        self.failUnlessEqual(kDeleteAliasIcon, fourcc('dali'))
-        self.failUnlessEqual(kEjectMediaIcon, fourcc('ejec'))
-        self.failUnlessEqual(kBurningIcon, fourcc('burn'))
-        self.failUnlessEqual(kRightContainerArrowIcon, fourcc('rcar'))
-        self.failUnlessEqual(kIconServicesNormalUsageFlag, 0)
-        self.failUnlessEqual(kIconServicesNoBadgeFlag, 1) 
-        self.failUnlessEqual(kIconServicesUpdateIfNeededFlag, 2)
-        self.failUnlessEqual(kIconServicesCatalogInfoMask, 531550)
+        self.assertEqual(kClipboardIcon, fourcc(b'CLIP'))
+        self.assertEqual(kClippingUnknownTypeIcon, fourcc(b'clpu'))
+        self.assertEqual(kClippingPictureTypeIcon, fourcc(b'clpp'))
+        self.assertEqual(kClippingTextTypeIcon, fourcc(b'clpt'))
+        self.assertEqual(kClippingSoundTypeIcon, fourcc(b'clps'))
+        self.assertEqual(kDesktopIcon, fourcc(b'desk'))
+        self.assertEqual(kFinderIcon, fourcc(b'FNDR'))
+        self.assertEqual(kComputerIcon, fourcc(b'root'))
+        self.assertEqual(kFontSuitcaseIcon, fourcc(b'FFIL'))
+        self.assertEqual(kFullTrashIcon, fourcc(b'ftrh'))
+        self.assertEqual(kGenericApplicationIcon, fourcc(b'APPL'))
+        self.assertEqual(kGenericCDROMIcon, fourcc(b'cddr'))
+        self.assertEqual(kGenericControlPanelIcon, fourcc(b'APPC'))
+        self.assertEqual(kGenericControlStripModuleIcon, fourcc(b'sdev'))
+        self.assertEqual(kGenericComponentIcon, fourcc(b'thng'))
+        self.assertEqual(kGenericDeskAccessoryIcon, fourcc(b'APPD'))
+        self.assertEqual(kGenericDocumentIcon, fourcc(b'docu'))
+        self.assertEqual(kGenericEditionFileIcon, fourcc(b'edtf'))
+        self.assertEqual(kGenericExtensionIcon, fourcc(b'INIT'))
+        self.assertEqual(kGenericFileServerIcon, fourcc(b'srvr'))
+        self.assertEqual(kGenericFontIcon, fourcc(b'ffil'))
+        self.assertEqual(kGenericFontScalerIcon, fourcc(b'sclr'))
+        self.assertEqual(kGenericFloppyIcon, fourcc(b'flpy'))
+        self.assertEqual(kGenericHardDiskIcon, fourcc(b'hdsk'))
+        self.assertEqual(kGenericIDiskIcon, fourcc(b'idsk'))
+        self.assertEqual(kGenericRemovableMediaIcon, fourcc(b'rmov'))
+        self.assertEqual(kGenericMoverObjectIcon, fourcc(b'movr'))
+        self.assertEqual(kGenericPCCardIcon, fourcc(b'pcmc'))
+        self.assertEqual(kGenericPreferencesIcon, fourcc(b'pref'))
+        self.assertEqual(kGenericQueryDocumentIcon, fourcc(b'qery'))
+        self.assertEqual(kGenericRAMDiskIcon, fourcc(b'ramd'))
+        self.assertEqual(kGenericSharedLibaryIcon, fourcc(b'shlb'))
+        self.assertEqual(kGenericStationeryIcon, fourcc(b'sdoc'))
+        self.assertEqual(kGenericSuitcaseIcon, fourcc(b'suit'))
+        self.assertEqual(kGenericURLIcon, fourcc(b'gurl'))
+        self.assertEqual(kGenericWORMIcon, fourcc(b'worm'))
+        self.assertEqual(kInternationalResourcesIcon, fourcc(b'ifil'))
+        self.assertEqual(kKeyboardLayoutIcon, fourcc(b'kfil'))
+        self.assertEqual(kSoundFileIcon, fourcc(b'sfil'))
+        self.assertEqual(kSystemSuitcaseIcon, fourcc(b'zsys'))
+        self.assertEqual(kTrashIcon, fourcc(b'trsh'))
+        self.assertEqual(kTrueTypeFontIcon, fourcc(b'tfil'))
+        self.assertEqual(kTrueTypeFlatFontIcon, fourcc(b'sfnt'))
+        self.assertEqual(kTrueTypeMultiFlatFontIcon, fourcc(b'ttcf'))
+        self.assertEqual(kUserIDiskIcon, fourcc(b'udsk'))
+        self.assertEqual(kUnknownFSObjectIcon, fourcc(b'unfs'))
+        self.assertEqual(kInternationResourcesIcon, kInternationalResourcesIcon)
+        self.assertEqual(kInternetLocationHTTPIcon, fourcc(b'ilht'))
+        self.assertEqual(kInternetLocationFTPIcon, fourcc(b'ilft'))
+        self.assertEqual(kInternetLocationAppleShareIcon, fourcc(b'ilaf'))
+        self.assertEqual(kInternetLocationAppleTalkZoneIcon, fourcc(b'ilat'))
+        self.assertEqual(kInternetLocationFileIcon, fourcc(b'ilfi'))
+        self.assertEqual(kInternetLocationMailIcon, fourcc(b'ilma'))
+        self.assertEqual(kInternetLocationNewsIcon, fourcc(b'ilnw'))
+        self.assertEqual(kInternetLocationNSLNeighborhoodIcon, fourcc(b'ilns'))
+        self.assertEqual(kInternetLocationGenericIcon, fourcc(b'ilge'))
+        self.assertEqual(kGenericFolderIcon, fourcc(b'fldr'))
+        self.assertEqual(kDropFolderIcon, fourcc(b'dbox'))
+        self.assertEqual(kMountedFolderIcon, fourcc(b'mntd'))
+        self.assertEqual(kOpenFolderIcon, fourcc(b'ofld'))
+        self.assertEqual(kOwnedFolderIcon, fourcc(b'ownd'))
+        self.assertEqual(kPrivateFolderIcon, fourcc(b'prvf'))
+        self.assertEqual(kSharedFolderIcon, fourcc(b'shfl'))
+        self.assertEqual(kSharingPrivsNotApplicableIcon, fourcc(b'shna'))
+        self.assertEqual(kSharingPrivsReadOnlyIcon, fourcc(b'shro'))
+        self.assertEqual(kSharingPrivsReadWriteIcon, fourcc(b'shrw'))
+        self.assertEqual(kSharingPrivsUnknownIcon, fourcc(b'shuk'))
+        self.assertEqual(kSharingPrivsWritableIcon, fourcc(b'writ'))
+        self.assertEqual(kUserFolderIcon, fourcc(b'ufld'))
+        self.assertEqual(kWorkgroupFolderIcon, fourcc(b'wfld'))
+        self.assertEqual(kGuestUserIcon, fourcc(b'gusr'))
+        self.assertEqual(kUserIcon, fourcc(b'user'))
+        self.assertEqual(kOwnerIcon, fourcc(b'susr'))
+        self.assertEqual(kGroupIcon, fourcc(b'grup'))
+        self.assertEqual(kAppearanceFolderIcon, fourcc(b'appr'))
+        self.assertEqual(kAppleExtrasFolderIcon, cast_int(0x616578C4))
+        self.assertEqual(kAppleMenuFolderIcon, fourcc(b'amnu'))
+        self.assertEqual(kApplicationsFolderIcon, fourcc(b'apps'))
+        self.assertEqual(kApplicationSupportFolderIcon, fourcc(b'asup'))
+        self.assertEqual(kAssistantsFolderIcon, cast_int(0x617374C4))
+        self.assertEqual(kColorSyncFolderIcon, fourcc(b'prof'))
+        self.assertEqual(kContextualMenuItemsFolderIcon, fourcc(b'cmnu'))
+        self.assertEqual(kControlPanelDisabledFolderIcon, fourcc(b'ctrD'))
+        self.assertEqual(kControlPanelFolderIcon, fourcc(b'ctrl'))
+        self.assertEqual(kControlStripModulesFolderIcon, cast_int(0x736476C4))
+        self.assertEqual(kDocumentsFolderIcon, fourcc(b'docs'))
+        self.assertEqual(kExtensionsDisabledFolderIcon, fourcc(b'extD'))
+        self.assertEqual(kExtensionsFolderIcon, fourcc(b'extn'))
+        self.assertEqual(kFavoritesFolderIcon, fourcc(b'favs'))
+        self.assertEqual(kFontsFolderIcon, fourcc(b'font'))
+        self.assertEqual(kHelpFolderIcon, cast_int(0xC4686C70))
+        self.assertEqual(kInternetFolderIcon, cast_int(0x696E74C4))
+        self.assertEqual(kInternetPlugInFolderIcon, cast_int(0xC46E6574))
+        self.assertEqual(kInternetSearchSitesFolderIcon, fourcc(b'issf'))
+        self.assertEqual(kLocalesFolderIcon, cast_int(0xC46C6F63))
+        self.assertEqual(kMacOSReadMeFolderIcon, cast_int(0x6D6F72C4))
+        self.assertEqual(kPublicFolderIcon, fourcc(b'pubf'))
+        self.assertEqual(kPreferencesFolderIcon, cast_int(0x707266C4))
+        self.assertEqual(kPrinterDescriptionFolderIcon, fourcc(b'ppdf'))
+        self.assertEqual(kPrinterDriverFolderIcon, cast_int(0xC4707264))
+        self.assertEqual(kPrintMonitorFolderIcon, fourcc(b'prnt'))
+        self.assertEqual(kRecentApplicationsFolderIcon, fourcc(b'rapp'))
+        self.assertEqual(kRecentDocumentsFolderIcon, fourcc(b'rdoc'))
+        self.assertEqual(kRecentServersFolderIcon, fourcc(b'rsrv'))
+        self.assertEqual(kScriptingAdditionsFolderIcon, cast_int(0xC4736372))
+        self.assertEqual(kSharedLibrariesFolderIcon, cast_int(0xC46C6962))
+        self.assertEqual(kScriptsFolderIcon, cast_int( 0x736372C4))
+        self.assertEqual(kShutdownItemsDisabledFolderIcon, fourcc(b'shdD'))
+        self.assertEqual(kShutdownItemsFolderIcon, fourcc(b'shdf'))
+        self.assertEqual(kSpeakableItemsFolder, fourcc(b'spki'))
+        self.assertEqual(kStartupItemsDisabledFolderIcon, fourcc(b'strD'))
+        self.assertEqual(kStartupItemsFolderIcon, fourcc(b'strt'))
+        self.assertEqual(kSystemExtensionDisabledFolderIcon, fourcc(b'macD'))
+        self.assertEqual(kSystemFolderIcon, fourcc(b'macs'))
+        self.assertEqual(kTextEncodingsFolderIcon, cast_int(0xC4746578))
+        self.assertEqual(kUsersFolderIcon, cast_int(0x757372C4))
+        self.assertEqual(kUtilitiesFolderIcon, cast_int(0x757469C4))
+        self.assertEqual(kVoicesFolderIcon, fourcc(b'fvoc'))
+        self.assertEqual(kAppleScriptBadgeIcon, fourcc(b'scrp'))
+        self.assertEqual(kLockedBadgeIcon, fourcc(b'lbdg'))
+        self.assertEqual(kMountedBadgeIcon, fourcc(b'mbdg'))
+        self.assertEqual(kSharedBadgeIcon, fourcc(b'sbdg'))
+        self.assertEqual(kAliasBadgeIcon, fourcc(b'abdg'))
+        self.assertEqual(kAlertCautionBadgeIcon, fourcc(b'cbdg'))
+        self.assertEqual(kAlertNoteIcon, fourcc(b'note'))
+        self.assertEqual(kAlertCautionIcon, fourcc(b'caut'))
+        self.assertEqual(kAlertStopIcon, fourcc(b'stop'))
+        self.assertEqual(kAppleTalkIcon, fourcc(b'atlk'))
+        self.assertEqual(kAppleTalkZoneIcon, fourcc(b'atzn'))
+        self.assertEqual(kAFPServerIcon, fourcc(b'afps'))
+        self.assertEqual(kFTPServerIcon, fourcc(b'ftps'))
+        self.assertEqual(kHTTPServerIcon, fourcc(b'htps'))
+        self.assertEqual(kGenericNetworkIcon, fourcc(b'gnet'))
+        self.assertEqual(kIPFileServerIcon, fourcc(b'isrv'))
+        self.assertEqual(kToolbarCustomizeIcon, fourcc(b'tcus'))
+        self.assertEqual(kToolbarDeleteIcon, fourcc(b'tdel'))
+        self.assertEqual(kToolbarFavoritesIcon, fourcc(b'tfav'))
+        self.assertEqual(kToolbarHomeIcon, fourcc(b'thom'))
+        self.assertEqual(kAppleLogoIcon, fourcc(b'capl'))
+        self.assertEqual(kAppleMenuIcon, fourcc(b'sapl'))
+        self.assertEqual(kBackwardArrowIcon, fourcc(b'baro'))
+        self.assertEqual(kFavoriteItemsIcon, fourcc(b'favr'))
+        self.assertEqual(kForwardArrowIcon, fourcc(b'faro'))
+        self.assertEqual(kGridIcon, fourcc(b'grid'))
+        self.assertEqual(kHelpIcon, fourcc(b'help'))
+        self.assertEqual(kKeepArrangedIcon, fourcc(b'arng'))
+        self.assertEqual(kLockedIcon, fourcc(b'lock'))
+        self.assertEqual(kNoFilesIcon, fourcc(b'nfil'))
+        self.assertEqual(kNoFolderIcon, fourcc(b'nfld'))
+        self.assertEqual(kNoWriteIcon, fourcc(b'nwrt'))
+        self.assertEqual(kProtectedApplicationFolderIcon, fourcc(b'papp'))
+        self.assertEqual(kProtectedSystemFolderIcon, fourcc(b'psys'))
+        self.assertEqual(kRecentItemsIcon, fourcc(b'rcnt'))
+        self.assertEqual(kShortcutIcon, fourcc(b'shrt'))
+        self.assertEqual(kSortAscendingIcon, fourcc(b'asnd'))
+        self.assertEqual(kSortDescendingIcon, fourcc(b'dsnd'))
+        self.assertEqual(kUnlockedIcon, fourcc(b'ulck'))
+        self.assertEqual(kConnectToIcon, fourcc(b'cnct'))
+        self.assertEqual(kGenericWindowIcon, fourcc(b'gwin'))
+        self.assertEqual(kQuestionMarkIcon, fourcc(b'ques'))
+        self.assertEqual(kDeleteAliasIcon, fourcc(b'dali'))
+        self.assertEqual(kEjectMediaIcon, fourcc(b'ejec'))
+        self.assertEqual(kBurningIcon, fourcc(b'burn'))
+        self.assertEqual(kRightContainerArrowIcon, fourcc(b'rcar'))
+        self.assertEqual(kIconServicesNormalUsageFlag, 0)
+        self.assertEqual(kIconServicesNoBadgeFlag, 1) 
+        self.assertEqual(kIconServicesUpdateIfNeededFlag, 2)
+        self.assertEqual(kIconServicesCatalogInfoMask, 531550)
   
     @onlyOn32Bit
     def testFunctions32(self):
         # Not tested, deprecated function
         GetIconRefFromFile
-        self.failUnlessArgIsOut(GetIconRefFromFolder, 5)
+        self.assertArgIsOut(GetIconRefFromFolder, 5)
 
         RegisterIconRefFromResource
         OverrideIconRefFromResource
         FlushIconRefs
         FlushIconRefsByVolume
 
-        self.failUnlessArgIsOut(RegisterIconRefFromIconFile, 3)
+        self.assertArgIsOut(RegisterIconRefFromIconFile, 3)
 
         ReadIconFile
         WriteIconFile
     
     def testFunctions(self):
-        self.failUnlessArgIsOut(GetIconRef, 3)
+        self.assertArgIsOut(GetIconRef, 3)
         err, icon = GetIconRef(0, kSystemIconsCreator, kShortcutIcon, None)
-        self.failUnlessIsInstance(err, (int, long))
-        self.failUnlessIsInstance(icon, IconRef)
+        self.assertIsInstance(err, (int, long))
+        self.assertIsInstance(icon, IconRef)
 
         try:
-            self.failUnlessArgIsOut(GetIconRefOwners, 1)
+            self.assertArgIsOut(GetIconRefOwners, 1)
             err, cnt = GetIconRefOwners(icon, None)
-            self.failUnlessIsInstance(err, (int, long))
-            self.failUnlessIsInstance(cnt, (int, long))
+            self.assertIsInstance(err, (int, long))
+            self.assertIsInstance(cnt, (int, long))
 
             err = AcquireIconRef(icon)
-            self.failUnlessEqual(err, 0)
+            self.assertEqual(err, 0)
 
             err = ReleaseIconRef(icon)
-            self.failUnlessEqual(err, 0)
+            self.assertEqual(err, 0)
 
-            self.failUnlessArgIsOut(GetIconRefFromFolder, 5)
+            self.assertArgIsOut(GetIconRefFromFolder, 5)
 
-            self.failUnlessArgHasType(GetIconRefFromFileInfo, 2, objc._C_IN + objc._C_PTR + objc._C_UNICHAR)
-            self.failUnlessArgIsOut(GetIconRefFromFileInfo, 6)
-            self.failUnlessArgIsOut(GetIconRefFromFileInfo, 7)
+            self.assertArgHasType(GetIconRefFromFileInfo, 2, objc._C_IN + objc._C_PTR + objc._C_UNICHAR)
+            self.assertArgIsOut(GetIconRefFromFileInfo, 6)
+            self.assertArgIsOut(GetIconRefFromFileInfo, 7)
 
-            self.failUnlessArgIsOut(GetIconRefFromTypeInfo, 5)
+            self.assertArgIsOut(GetIconRefFromTypeInfo, 5)
 
-            self.failUnlessArgIsIn(GetIconRefFromIconFamilyPtr, 0)
-            self.failUnlessArgIsOut(GetIconRefFromIconFamilyPtr, 2)
+            self.assertArgIsIn(GetIconRefFromIconFamilyPtr, 0)
+            self.assertArgIsOut(GetIconRefFromIconFamilyPtr, 2)
 
-            self.failUnlessArgIsOut(GetIconRefFromComponent, 1)
+            self.assertArgIsOut(GetIconRefFromComponent, 1)
 
             # XXX: Untested for now...
             RegisterIconRefFromIconFamily
             OverrideIconRef
             RemoveIconRefOverride
 
-            self.failUnlessArgIsOut(CompositeIconRef, 2)
+            self.assertArgIsOut(CompositeIconRef, 2)
 
-            self.failUnlessArgIsOut(IsIconRefComposite, 1)
-            self.failUnlessArgIsOut(IsIconRefComposite, 2)
+            self.assertArgIsOut(IsIconRefComposite, 1)
+            self.assertArgIsOut(IsIconRefComposite, 2)
 
-            self.failUnlessResultIsBOOL(IsValidIconRef)
-            self.failUnlessResultIsBOOL(IsDataAvailableInIconRef)
+            self.assertResultIsBOOL(IsValidIconRef)
+            self.assertResultIsBOOL(IsDataAvailableInIconRef)
 
-            self.failUnlessArgIsBOOL(SetCustomIconsEnabled, 1)
-            self.failUnlessArgIsOut(GetCustomIconsEnabled, 1)
-            self.failUnlessArgHasType(GetCustomIconsEnabled, 1, objc._C_OUT + objc._C_PTR + objc._C_NSBOOL)
+            self.assertArgIsBOOL(SetCustomIconsEnabled, 1)
+            self.assertArgIsOut(GetCustomIconsEnabled, 1)
+            self.assertArgHasType(GetCustomIconsEnabled, 1, objc._C_OUT + objc._C_PTR + objc._C_NSBOOL)
 
             
             # Untested...
 
         finally:
             err = ReleaseIconRef(icon)
-            self.failUnlessEqual(err, 0)
+            self.assertEqual(err, 0)
 
     def testOpaque(self):
-        self.failUnlessIsOpaquePointer(IconRef)
+        self.assertIsOpaquePointer(IconRef)
 
 
 if __name__ == "__main__":

pyobjc-framework-LaunchServices/PyObjCTest/test_lsinfo.py

 
 class TestLSInfo (TestCase):
     def testConstants(self):
-        self.failUnlessEqual(kLSAppInTrashErr, -10660)
-        self.failUnlessEqual(kLSExecutableIncorrectFormat, -10661)
-        self.failUnlessEqual(kLSAttributeNotFoundErr, -10662)
-        self.failUnlessEqual(kLSAttributeNotSettableErr, -10663)
-        self.failUnlessEqual(kLSUnknownErr, -10810)
-        self.failUnlessEqual(kLSNotAnApplicationErr, -10811)
-        self.failUnlessEqual(kLSNotInitializedErr, -10812)
-        self.failUnlessEqual(kLSDataUnavailableErr, -10813)
-        self.failUnlessEqual(kLSApplicationNotFoundErr, -10814)
-        self.failUnlessEqual(kLSUnknownTypeErr, -10815)
-        self.failUnlessEqual(kLSDataTooOldErr, -10816)
-        self.failUnlessEqual(kLSDataErr, -10817)
-        self.failUnlessEqual(kLSLaunchInProgressErr, -10818)
-        self.failUnlessEqual(kLSNotRegisteredErr, -10819)
-        self.failUnlessEqual(kLSAppDoesNotClaimTypeErr, -10820)
-        self.failUnlessEqual(kLSAppDoesNotSupportSchemeWarning, -10821)
-        self.failUnlessEqual(kLSServerCommunicationErr, -10822)
-        self.failUnlessEqual(kLSCannotSetInfoErr, -10823)
-        self.failUnlessEqual(kLSNoRegistrationInfoErr, -10824)
-        self.failUnlessEqual(kLSIncompatibleSystemVersionErr, -10825)
-        self.failUnlessEqual(kLSNoLaunchPermissionErr, -10826)
-        self.failUnlessEqual(kLSNoExecutableErr, -10827)
-        self.failUnlessEqual(kLSNoClassicEnvironmentErr, -10828)
-        self.failUnlessEqual(kLSMultipleSessionsNotSupportedErr, -10829)
-        self.failUnlessEqual(kLSInitializeDefaults, 0x00000001)
-        self.failUnlessEqual(kLSMinCatInfoBitmap, 6154)
-        self.failUnlessEqual(kLSRequestExtension, 0x00000001)
-        self.failUnlessEqual(kLSRequestTypeCreator, 0x00000002)
-        self.failUnlessEqual(kLSRequestBasicFlagsOnly, 0x00000004)
-        self.failUnlessEqual(kLSRequestAppTypeFlags, 0x00000008)
-        self.failUnlessEqual(kLSRequestAllFlags, 0x00000010)
-        self.failUnlessEqual(kLSRequestIconAndKind, 0x00000020)
-        self.failUnlessEqual(kLSRequestExtensionFlagsOnly, 0x00000040)
-        self.failUnlessEqual(kLSRequestAllInfo, cast_int(0xFFFFFFFF))
-        self.failUnlessEqual(kLSItemInfoIsPlainFile, 0x00000001)
-        self.failUnlessEqual(kLSItemInfoIsPackage, 0x00000002)
-        self.failUnlessEqual(kLSItemInfoIsApplication, 0x00000004)
-        self.failUnlessEqual(kLSItemInfoIsContainer, 0x00000008)
-        self.failUnlessEqual(kLSItemInfoIsAliasFile, 0x00000010)
-        self.failUnlessEqual(kLSItemInfoIsSymlink, 0x00000020)
-        self.failUnlessEqual(kLSItemInfoIsInvisible, 0x00000040)
-        self.failUnlessEqual(kLSItemInfoIsNativeApp, 0x00000080)
-        self.failUnlessEqual(kLSItemInfoIsClassicApp, 0x00000100)
-        self.failUnlessEqual(kLSItemInfoAppPrefersNative, 0x00000200)
-        self.failUnlessEqual(kLSItemInfoAppPrefersClassic, 0x00000400)
-        self.failUnlessEqual(kLSItemInfoAppIsScriptable, 0x00000800)
-        self.failUnlessEqual(kLSItemInfoIsVolume, 0x00001000)
-        self.failUnlessEqual(kLSItemInfoExtensionIsHidden, 0x00100000)
-        self.failUnlessEqual(kLSRolesNone, 0x00000001)
-        self.failUnlessEqual(kLSRolesViewer, 0x00000002)
-        self.failUnlessEqual(kLSRolesEditor, 0x00000004)
-        self.failUnlessEqual(kLSRolesShell, 0x00000008)
-        self.failUnlessEqual(kLSRolesAll, cast_int(0xFFFFFFFF))
-        self.failUnlessEqual(kLSUnknownKindID, 0)
-        self.failUnlessEqual(kLSUnknownType, 0)
-        self.failUnlessEqual(kLSUnknownCreator, 0)
-        self.failUnlessEqual(kLSAcceptDefault, 0x00000001)
-        self.failUnlessEqual(kLSAcceptAllowLoginUI, 0x00000002)
+        self.assertEqual(kLSAppInTrashErr, -10660)
+        self.assertEqual(kLSExecutableIncorrectFormat, -10661)
+        self.assertEqual(kLSAttributeNotFoundErr, -10662)
+        self.assertEqual(kLSAttributeNotSettableErr, -10663)
+        self.assertEqual(kLSUnknownErr, -10810)
+        self.assertEqual(kLSNotAnApplicationErr, -10811)
+        self.assertEqual(kLSNotInitializedErr, -10812)
+        self.assertEqual(kLSDataUnavailableErr, -10813)
+        self.assertEqual(kLSApplicationNotFoundErr, -10814)
+        self.assertEqual(kLSUnknownTypeErr, -10815)
+        self.assertEqual(kLSDataTooOldErr, -10816)
+        self.assertEqual(kLSDataErr, -10817)
+        self.assertEqual(kLSLaunchInProgressErr, -10818)
+        self.assertEqual(kLSNotRegisteredErr, -10819)
+        self.assertEqual(kLSAppDoesNotClaimTypeErr, -10820)
+        self.assertEqual(kLSAppDoesNotSupportSchemeWarning, -10821)
+        self.assertEqual(kLSServerCommunicationErr, -10822)
+        self.assertEqual(kLSCannotSetInfoErr, -10823)
+        self.assertEqual(kLSNoRegistrationInfoErr, -10824)
+        self.assertEqual(kLSIncompatibleSystemVersionErr, -10825)
+        self.assertEqual(kLSNoLaunchPermissionErr, -10826)
+        self.assertEqual(kLSNoExecutableErr, -10827)
+        self.assertEqual(kLSNoClassicEnvironmentErr, -10828)
+        self.assertEqual(kLSMultipleSessionsNotSupportedErr, -10829)
+        self.assertEqual(kLSInitializeDefaults, 0x00000001)
+        self.assertEqual(kLSMinCatInfoBitmap, 6154)
+        self.assertEqual(kLSRequestExtension, 0x00000001)
+        self.assertEqual(kLSRequestTypeCreator, 0x00000002)
+        self.assertEqual(kLSRequestBasicFlagsOnly, 0x00000004)
+        self.assertEqual(kLSRequestAppTypeFlags, 0x00000008)
+        self.assertEqual(kLSRequestAllFlags, 0x00000010)
+        self.assertEqual(kLSRequestIconAndKind, 0x00000020)
+        self.assertEqual(kLSRequestExtensionFlagsOnly, 0x00000040)
+        self.assertEqual(kLSRequestAllInfo, cast_int(0xFFFFFFFF))
+        self.assertEqual(kLSItemInfoIsPlainFile, 0x00000001)
+        self.assertEqual(kLSItemInfoIsPackage, 0x00000002)
+        self.assertEqual(kLSItemInfoIsApplication, 0x00000004)
+        self.assertEqual(kLSItemInfoIsContainer, 0x00000008)
+        self.assertEqual(kLSItemInfoIsAliasFile, 0x00000010)
+        self.assertEqual(kLSItemInfoIsSymlink, 0x00000020)
+        self.assertEqual(kLSItemInfoIsInvisible, 0x00000040)
+        self.assertEqual(kLSItemInfoIsNativeApp, 0x00000080)
+        self.assertEqual(kLSItemInfoIsClassicApp, 0x00000100)
+        self.assertEqual(kLSItemInfoAppPrefersNative, 0x00000200)
+        self.assertEqual(kLSItemInfoAppPrefersClassic, 0x00000400)
+        self.assertEqual(kLSItemInfoAppIsScriptable, 0x00000800)
+        self.assertEqual(kLSItemInfoIsVolume, 0x00001000)
+        self.assertEqual(kLSItemInfoExtensionIsHidden, 0x00100000)
+        self.assertEqual(kLSRolesNone, 0x00000001)
+        self.assertEqual(kLSRolesViewer, 0x00000002)
+        self.assertEqual(kLSRolesEditor, 0x00000004)
+        self.assertEqual(kLSRolesShell, 0x00000008)
+        self.assertEqual(kLSRolesAll, cast_int(0xFFFFFFFF))
+        self.assertEqual(kLSUnknownKindID, 0)
+        self.assertEqual(kLSUnknownType, 0)
+        self.assertEqual(kLSUnknownCreator, 0)
+        self.assertEqual(kLSAcceptDefault, 0x00000001)
+        self.assertEqual(kLSAcceptAllowLoginUI, 0x00000002)
 
     def testFunctions(self):
         LSInit(kLSInitializeDefaults)
 
         path = "/Library/Documents/Acknowledgements.rtf"
         url = CFURLCreateFromFileSystemRepresentation(None, path, len(path), True)
-        self.failUnlessIsInstance(url, CFURLRef)
+        self.assertIsInstance(url, CFURLRef)
 
         ok, info = LSCopyItemInfoForURL(url, kLSRequestExtension|kLSRequestTypeCreator, None)
-        self.failUnlessEqual(ok, 0)
-        self.failUnlessIsInstance(info, LSItemInfoRecord)
+        self.assertEqual(ok, 0)
+        self.assertIsInstance(info, LSItemInfoRecord)
 
         self.fail("Start at LSGetExtensionInfo")
 

pyobjc-framework-LaunchServices/PyObjCTest/test_lsopen.py

 
 class TestLSOpen (TestCase):
     def testConstants(self):
-        self.failUnlessEqual(kLSLaunchDefaults, 0x00000001)
-        self.failUnlessEqual(kLSLaunchAndPrint, 0x00000002)
-        self.failUnlessEqual(kLSLaunchReserved2, 0x00000004)
-        self.failUnlessEqual(kLSLaunchReserved3, 0x00000008)
-        self.failUnlessEqual(kLSLaunchReserved4, 0x00000010)
-        self.failUnlessEqual(kLSLaunchReserved5, 0x00000020)
-        self.failUnlessEqual(kLSLaunchAndDisplayErrors, 0x00000040)
-        self.failUnlessEqual(kLSLaunchInhibitBGOnly, 0x00000080)
-        self.failUnlessEqual(kLSLaunchDontAddToRecents, 0x00000100)
-        self.failUnlessEqual(kLSLaunchDontSwitch, 0x00000200)
-        self.failUnlessEqual(kLSLaunchNoParams, 0x00000800)
-        self.failUnlessEqual(kLSLaunchAsync, 0x00010000)
-        self.failUnlessEqual(kLSLaunchStartClassic, 0x00020000)
-        self.failUnlessEqual(kLSLaunchInClassic, 0x00040000)
-        self.failUnlessEqual(kLSLaunchNewInstance, 0x00080000)
-        self.failUnlessEqual(kLSLaunchAndHide, 0x00100000)
-        self.failUnlessEqual(kLSLaunchAndHideOthers, 0x00200000)
-        self.failUnlessEqual(kLSLaunchHasUntrustedContents, 0x00400000)
+        self.assertEqual(kLSLaunchDefaults, 0x00000001)
+        self.assertEqual(kLSLaunchAndPrint, 0x00000002)
+        self.assertEqual(kLSLaunchReserved2, 0x00000004)
+        self.assertEqual(kLSLaunchReserved3, 0x00000008)
+        self.assertEqual(kLSLaunchReserved4, 0x00000010)
+        self.assertEqual(kLSLaunchReserved5, 0x00000020)
+        self.assertEqual(kLSLaunchAndDisplayErrors, 0x00000040)
+        self.assertEqual(kLSLaunchInhibitBGOnly, 0x00000080)
+        self.assertEqual(kLSLaunchDontAddToRecents, 0x00000100)
+        self.assertEqual(kLSLaunchDontSwitch, 0x00000200)
+        self.assertEqual(kLSLaunchNoParams, 0x00000800)
+        self.assertEqual(kLSLaunchAsync, 0x00010000)
+        self.assertEqual(kLSLaunchStartClassic, 0x00020000)
+        self.assertEqual(kLSLaunchInClassic, 0x00040000)
+        self.assertEqual(kLSLaunchNewInstance, 0x00080000)
+        self.assertEqual(kLSLaunchAndHide, 0x00100000)
+        self.assertEqual(kLSLaunchAndHideOthers, 0x00200000)
+        self.assertEqual(kLSLaunchHasUntrustedContents, 0x00400000)
 
     def testStructs(self):
         pass

pyobjc-framework-LaunchServices/PyObjCTest/test_lsquarantine.py

 
 class TestLSQuarantine (TestCase):
     def testConstants(self):
-        self.failUnlessIsInstance(kLSQuarantineAgentNameKey, unicode)
-        self.failUnlessIsInstance(kLSQuarantineAgentBundleIdentifierKey, unicode)
-        self.failUnlessIsInstance(kLSQuarantineTimeStampKey, unicode)
-        self.failUnlessIsInstance(kLSQuarantineTypeKey, unicode)
-        self.failUnlessIsInstance(kLSQuarantineTypeWebDownload, unicode)
-        self.failUnlessIsInstance(kLSQuarantineTypeOtherDownload, unicode)
-        self.failUnlessIsInstance(kLSQuarantineTypeEmailAttachment, unicode)
-        self.failUnlessIsInstance(kLSQuarantineTypeInstantMessageAttachment, unicode)
-        self.failUnlessIsInstance(kLSQuarantineTypeCalendarEventAttachment, unicode)
-        self.failUnlessIsInstance(kLSQuarantineTypeOtherAttachment, unicode)
-        self.failUnlessIsInstance(kLSQuarantineOriginURLKey, unicode)
-        self.failUnlessIsInstance(kLSQuarantineDataURLKey, unicode)
+        self.assertIsInstance(kLSQuarantineAgentNameKey, unicode)
+        self.assertIsInstance(kLSQuarantineAgentBundleIdentifierKey, unicode)
+        self.assertIsInstance(kLSQuarantineTimeStampKey, unicode)
+        self.assertIsInstance(kLSQuarantineTypeKey, unicode)
+        self.assertIsInstance(kLSQuarantineTypeWebDownload, unicode)
+        self.assertIsInstance(kLSQuarantineTypeOtherDownload, unicode)
+        self.assertIsInstance(kLSQuarantineTypeEmailAttachment, unicode)
+        self.assertIsInstance(kLSQuarantineTypeInstantMessageAttachment, unicode)
+        self.assertIsInstance(kLSQuarantineTypeCalendarEventAttachment, unicode)
+        self.assertIsInstance(kLSQuarantineTypeOtherAttachment, unicode)
+        self.assertIsInstance(kLSQuarantineOriginURLKey, unicode)
+        self.assertIsInstance(kLSQuarantineDataURLKey, unicode)
 
 if __name__ == "__main__":
     main()

pyobjc-framework-LaunchServices/PyObjCTest/test_lssharedfilelist.py

         self.fail("Add header tests for <LaunchServices/LSSharedFileList.h>")
 
     def testTypes(self):
-        self.failUnlessIsCFType(LSSharedFileListRef)
-        self.failUnlessIsCFType(LSSharedFileListItemRef)
+        self.assertIsCFType(LSSharedFileListRef)
+        self.assertIsCFType(LSSharedFileListItemRef)
 
     @min_os_level('10.5')
     def testConstants10_5(self):
-        self.failUnlessIsInstance(kLSSharedFileListFavoriteVolumes, unicode)
-        self.failUnlessIsInstance(kLSSharedFileListFavoriteItems, unicode)
-        self.failUnlessIsInstance(kLSSharedFileListRecentApplicationItems, unicode)
-        self.failUnlessIsInstance(kLSSharedFileListRecentDocumentItems, unicode)
-        self.failUnlessIsInstance(kLSSharedFileListRecentServerItems, unicode)
-        self.failUnlessIsInstance(kLSSharedFileListSessionLoginItems, unicode)
-        self.failUnlessIsInstance(kLSSharedFileListGlobalLoginItems, unicode)
-        self.failUnlessIsInstance(kLSSharedFileListRecentItemsMaxAmount, unicode)
-        self.failUnlessIsInstance(kLSSharedFileListVolumesComputerVisible, unicode)
-        self.failUnlessIsInstance(kLSSharedFileListVolumesIDiskVisible, unicode)
-        self.failUnlessIsInstance(kLSSharedFileListVolumesNetworkVisible, unicode)
-        self.failUnlessIsInstance(kLSSharedFileListItemBeforeFirst, LSSharedFileListItemRef)
-        self.failUnlessIsInstance(kLSSharedFileListItemLast, LSSharedFileListItemRef)
-        self.failUnlessIsInstance(kLSSharedFileListItemHidden, unicode)
+        self.assertIsInstance(kLSSharedFileListFavoriteVolumes, unicode)
+        self.assertIsInstance(kLSSharedFileListFavoriteItems, unicode)
+        self.assertIsInstance(kLSSharedFileListRecentApplicationItems, unicode)
+        self.assertIsInstance(kLSSharedFileListRecentDocumentItems, unicode)
+        self.assertIsInstance(kLSSharedFileListRecentServerItems, unicode)
+        self.assertIsInstance(kLSSharedFileListSessionLoginItems, unicode)
+        self.assertIsInstance(kLSSharedFileListGlobalLoginItems, unicode)
+        self.assertIsInstance(kLSSharedFileListRecentItemsMaxAmount, unicode)
+        self.assertIsInstance(kLSSharedFileListVolumesComputerVisible, unicode)
+        self.assertIsInstance(kLSSharedFileListVolumesIDiskVisible, unicode)
+        self.assertIsInstance(kLSSharedFileListVolumesNetworkVisible, unicode)
+        self.assertIsInstance(kLSSharedFileListItemBeforeFirst, LSSharedFileListItemRef)
+        self.assertIsInstance(kLSSharedFileListItemLast, LSSharedFileListItemRef)
+        self.assertIsInstance(kLSSharedFileListItemHidden, unicode)
 
     def testConstants(self):
-        self.failUnlessEqual(kLSSharedFileListNoUserInteraction, 1)
-        self.failUnlessEqual(kLSSharedFileListDoNotMountVolumes, 2)
+        self.assertEqual(kLSSharedFileListNoUserInteraction, 1)
+        self.assertEqual(kLSSharedFileListDoNotMountVolumes, 2)
 
     def testFunctions(self):
-        self.failUnlessIsInstance(LSSharedFileListGetTypeID(), (int, long))
-        self.failUnlessIsInstance(LSSharedFileListItemGetTypeID(), (int, long))
+        self.assertIsInstance(LSSharedFileListGetTypeID(), (int, long))
+        self.assertIsInstance(LSSharedFileListItemGetTypeID(), (int, long))
 
-        self.failUnlessResultIsCFRetained(LSSharedFileListCreate)
+        self.assertResultIsCFRetained(LSSharedFileListCreate)
         lst = LSSharedFileListCreate(None, kLSSharedFileListFavoriteItems, None)
-        self.failUnlessIsInstance(lst, LSSharedFileListRef)
+        self.assertIsInstance(lst, LSSharedFileListRef)
 
         rl = CFRunLoopGetCurrent()
 
 
-        self.failUnlessArgIsFunction(LSSharedFileListAddObserver, 3, 'v^{OpaqueLSSharedFileListRef=}^v', True)
-        self.failUnlessArgHasType(LSSharedFileListAddObserver, 4, '^v')
+        self.assertArgIsFunction(LSSharedFileListAddObserver, 3, b'v^{OpaqueLSSharedFileListRef=}^v', True)
+        self.assertArgHasType(LSSharedFileListAddObserver, 4, b'^v')
 
         @objc.callbackFor(LSSharedFileListAddObserver)
         def callback(lst, ctxt):
         LSSharedFileListRemoveObserver(lst, rl, kCFRunLoopDefaultMode, callback, None)
 
         v = LSSharedFileListGetSeedValue(lst)
-        self.failUnlessIsInstance(v, (int, long))
+        self.assertIsInstance(v, (int, long))
 
-        self.failUnlessResultIsCFRetained(LSSharedFileListCopyProperty)
-        self.failUnlessResultHasType(LSSharedFileListCopyProperty, '@')
+        self.assertResultIsCFRetained(LSSharedFileListCopyProperty)
+        self.assertResultHasType(LSSharedFileListCopyProperty, b'@')
         v = LSSharedFileListCopyProperty(lst, u"name")
 
         v = LSSharedFileListSetProperty(lst, u"pyobjc.name", u"value")
-        self.failUnlessIsInstance(v, (int, long))
+        self.assertIsInstance(v, (int, long))
         v = LSSharedFileListCopyProperty(lst, u"name")
-        self.failUnlessEqual(v, u"value")
+        self.assertEqual(v, u"value")
 
-        self.failUnlessArgIsOut(LSSharedFileListCopySnapshot, 1)
+        self.assertArgIsOut(LSSharedFileListCopySnapshot, 1)
         v, seed = LSSharedFileListCopySnapshot(lst, None)
-        self.failUnlessIsInstance(v, CFArrayRef)
-        self.failUnlessIsInstance(seed, (int,long))
+        self.assertIsInstance(v, CFArrayRef)
+        self.assertIsInstance(seed, (int,long))
 
-        self.failUnlessResultIsCFRetained(LSSharedFileListInsertItemURL)
+        self.assertResultIsCFRetained(LSSharedFileListInsertItemURL)
         item = LSSharedFileListInsertItemURL(lst, kLSSharedFileListItemLast, "PyObjC.Test", None, 
                 CFURLCreateWithString(None, "file:///etc/hosts", None), {}, [])
-        self.failUnlessIsInstance(item, LSSharedFileListItemRef)
+        self.assertIsInstance(item, LSSharedFileListItemRef)
 
         v = LSSharedFileListItemGetID(item)
-        self.failUnlessIsInstance(v, (int, long))
+        self.assertIsInstance(v, (int, long))
 
         v = LSSharedFileListItemCopyIconRef(item)
-        self.failUnless(v is None)
+        self.assertIsObject(v, None)
 
-        self.failUnlessResultIsCFRetained(LSSharedFileListItemCopyDisplayName)
+        self.assertResultIsCFRetained(LSSharedFileListItemCopyDisplayName)
         v = LSSharedFileListItemCopyDisplayName(item)
-        self.failUnlessIsInstance(v, unicode)
+        self.assertIsInstance(v, unicode)
 
-        self.failUnlessArgIsOut(LSSharedFileListItemResolve, 2)
-        self.failUnlessArgIsOut(LSSharedFileListItemResolve, 3)
-        self.failUnlessArgIsCFRetained(LSSharedFileListItemResolve, 2)
+        self.assertArgIsOut(LSSharedFileListItemResolve, 2)
+        self.assertArgIsOut(LSSharedFileListItemResolve, 3)
+        self.assertArgIsCFRetained(LSSharedFileListItemResolve, 2)
         v, url, ref = LSSharedFileListItemResolve(item, 0, None, objc.NULL)
-        self.failUnlessIsInstance(v, (int, long))
-        self.failUnlessIsInstance(url, CFURLRef)
+        self.assertIsInstance(v, (int, long))
+        self.assertIsInstance(url, CFURLRef)
 
         v = LSSharedFileListItemSetProperty(item, u"name", u"pyobjc.test")
-        self.failUnlessIsInstance(v, (int, long))
+        self.assertIsInstance(v, (int, long))
 
-        self.failUnlessResultIsCFRetained(LSSharedFileListItemCopyProperty)
+        self.assertResultIsCFRetained(LSSharedFileListItemCopyProperty)
         v = LSSharedFileListItemCopyProperty(item, u"name")
-        self.failUnlessEqual(v, "pyobjc.test")
+        self.assertEqual(v, "pyobjc.test")
 
         v = LSSharedFileListItemMove(lst, item, kLSSharedFileListItemBeforeFirst)
-        self.failUnlessIsInstance(v, (int, long))
+        self.assertIsInstance(v, (int, long))
 
         v = LSSharedFileListItemRemove(lst, item)
-        self.failUnlessIsInstance(v, (int, long))
+        self.assertIsInstance(v, (int, long))
 
         v = LSSharedFileListRemoveAllItems(lst)
-        self.failUnlessIsInstance(v, (int, long))
+        self.assertIsInstance(v, (int, long))
 
 
 

pyobjc-framework-LaunchServices/PyObjCTest/test_utcoretypes.py

 
 class TestUTCoreTypes (TestCase):
     def testConstants(self):
-        self.failUnlessIsInstance(kUTTypeItem, unicode)
-        self.failUnlessIsInstance(kUTTypeContent, unicode)
-        self.failUnlessIsInstance(kUTTypeCompositeContent, unicode)
-        self.failUnlessIsInstance(kUTTypeApplication, unicode)
-        self.failUnlessIsInstance(kUTTypeMessage, unicode)
-        self.failUnlessIsInstance(kUTTypeContact, unicode)
-        self.failUnlessIsInstance(kUTTypeArchive, unicode)
-        self.failUnlessIsInstance(kUTTypeDiskImage, unicode)
-        self.failUnlessIsInstance(kUTTypeData, unicode)
-        self.failUnlessIsInstance(kUTTypeDirectory, unicode)
-        self.failUnlessIsInstance(kUTTypeResolvable, unicode)
-        self.failUnlessIsInstance(kUTTypeSymLink, unicode)
-        self.failUnlessIsInstance(kUTTypeMountPoint, unicode)
-        self.failUnlessIsInstance(kUTTypeAliasFile, unicode)
-        self.failUnlessIsInstance(kUTTypeAliasRecord, unicode)
-        self.failUnlessIsInstance(kUTTypeURL, unicode)
-        self.failUnlessIsInstance(kUTTypeFileURL, unicode)
-        self.failUnlessIsInstance(kUTTypeText, unicode)
-        self.failUnlessIsInstance(kUTTypePlainText, unicode)
-        self.failUnlessIsInstance(kUTTypeUTF8PlainText, unicode)
-        self.failUnlessIsInstance(kUTTypeUTF16ExternalPlainText, unicode)
-        self.failUnlessIsInstance(kUTTypeUTF16PlainText, unicode)
-        self.failUnlessIsInstance(kUTTypeRTF, unicode)
-        self.failUnlessIsInstance(kUTTypeHTML, unicode)
-        self.failUnlessIsInstance(kUTTypeXML, unicode)
-        self.failUnlessIsInstance(kUTTypeSourceCode, unicode)
-        self.failUnlessIsInstance(kUTTypeCSource, unicode)
-        self.failUnlessIsInstance(kUTTypeObjectiveCSource, unicode)
-        self.failUnlessIsInstance(kUTTypeCPlusPlusSource, unicode)
-        self.failUnlessIsInstance(kUTTypeObjectiveCPlusPlusSource, unicode)
-        self.failUnlessIsInstance(kUTTypeCHeader, unicode)
-        self.failUnlessIsInstance(kUTTypeCPlusPlusHeader, unicode)
-        self.failUnlessIsInstance(kUTTypeJavaSource, unicode)
-        self.failUnlessIsInstance(kUTTypePDF, unicode)
-        self.failUnlessIsInstance(kUTTypeRTFD, unicode)
-        self.failUnlessIsInstance(kUTTypeFlatRTFD, unicode)
-        self.failUnlessIsInstance(kUTTypeTXNTextAndMultimediaData, unicode)
-        self.failUnlessIsInstance(kUTTypeWebArchive, unicode)
-        self.failUnlessIsInstance(kUTTypeImage, unicode)
-        self.failUnlessIsInstance(kUTTypeJPEG, unicode)
-        self.failUnlessIsInstance(kUTTypeJPEG2000, unicode)
-        self.failUnlessIsInstance(kUTTypeTIFF, unicode)
-        self.failUnlessIsInstance(kUTTypePICT, unicode)
-        self.failUnlessIsInstance(kUTTypeGIF, unicode)
-        self.failUnlessIsInstance(kUTTypePNG, unicode)
-        self.failUnlessIsInstance(kUTTypeQuickTimeImage, unicode)
-        self.failUnlessIsInstance(kUTTypeAppleICNS, unicode)
-        self.failUnlessIsInstance(kUTTypeBMP, unicode)
-        self.failUnlessIsInstance(kUTTypeICO, unicode)
-        self.failUnlessIsInstance(kUTTypeAudiovisualContent, unicode)
-        self.failUnlessIsInstance(kUTTypeMovie, unicode)
-        self.failUnlessIsInstance(kUTTypeVideo, unicode)
-        self.failUnlessIsInstance(kUTTypeAudio, unicode)
-        self.failUnlessIsInstance(kUTTypeQuickTimeMovie, unicode)
-        self.failUnlessIsInstance(kUTTypeMPEG, unicode)
-        self.failUnlessIsInstance(kUTTypeMPEG4, unicode)
-        self.failUnlessIsInstance(kUTTypeMP3, unicode)
-        self.failUnlessIsInstance(kUTTypeMPEG4Audio, unicode)
-        self.failUnlessIsInstance(kUTTypeAppleProtectedMPEG4Audio, unicode)
-        self.failUnlessIsInstance(kUTTypeFolder, unicode)
-        self.failUnlessIsInstance(kUTTypeVolume, unicode)
-        self.failUnlessIsInstance(kUTTypePackage, unicode)
-        self.failUnlessIsInstance(kUTTypeBundle, unicode)
-        self.failUnlessIsInstance(kUTTypeFramework, unicode)
-        self.failUnlessIsInstance(kUTTypeApplicationBundle, unicode)
-        self.failUnlessIsInstance(kUTTypeApplicationFile, unicode)
-        self.failUnlessIsInstance(kUTTypeVCard, unicode)
-        self.failUnlessIsInstance(kUTTypeInkText, unicode)
+        self.assertIsInstance(kUTTypeItem, unicode)
+        self.assertIsInstance(kUTTypeContent, unicode)
+        self.assertIsInstance(kUTTypeCompositeContent, unicode)
+        self.assertIsInstance(kUTTypeApplication, unicode)
+        self.assertIsInstance(kUTTypeMessage, unicode)
+        self.assertIsInstance(kUTTypeContact, unicode)
+        self.assertIsInstance(kUTTypeArchive, unicode)
+        self.assertIsInstance(kUTTypeDiskImage, unicode)
+        self.assertIsInstance(kUTTypeData, unicode)
+        self.assertIsInstance(kUTTypeDirectory, unicode)
+        self.assertIsInstance(kUTTypeResolvable, unicode)
+        self.assertIsInstance(kUTTypeSymLink, unicode)
+        self.assertIsInstance(kUTTypeMountPoint, unicode)
+        self.assertIsInstance(kUTTypeAliasFile, unicode)
+        self.assertIsInstance(kUTTypeAliasRecord, unicode)
+        self.assertIsInstance(kUTTypeURL, unicode)
+        self.assertIsInstance(kUTTypeFileURL, unicode)
+        self.assertIsInstance(kUTTypeText, unicode)
+        self.assertIsInstance(kUTTypePlainText, unicode)
+        self.assertIsInstance(kUTTypeUTF8PlainText, unicode)
+        self.assertIsInstance(kUTTypeUTF16ExternalPlainText, unicode)
+        self.assertIsInstance(kUTTypeUTF16PlainText, unicode)
+        self.assertIsInstance(kUTTypeRTF, unicode)
+        self.assertIsInstance(kUTTypeHTML, unicode)
+        self.assertIsInstance(kUTTypeXML, unicode)
+        self.assertIsInstance(kUTTypeSourceCode, unicode)
+        self.assertIsInstance(kUTTypeCSource, unicode)
+        self.assertIsInstance(kUTTypeObjectiveCSource, unicode)
+        self.assertIsInstance(kUTTypeCPlusPlusSource, unicode)
+        self.assertIsInstance(kUTTypeObjectiveCPlusPlusSource, unicode)
+        self.assertIsInstance(kUTTypeCHeader, unicode)
+        self.assertIsInstance(kUTTypeCPlusPlusHeader, unicode)
+        self.assertIsInstance(kUTTypeJavaSource, unicode)
+        self.assertIsInstance(kUTTypePDF, unicode)
+        self.assertIsInstance(kUTTypeRTFD, unicode)
+        self.assertIsInstance(kUTTypeFlatRTFD, unicode)
+        self.assertIsInstance(kUTTypeTXNTextAndMultimediaData, unicode)
+        self.assertIsInstance(kUTTypeWebArchive, unicode)
+        self.assertIsInstance(kUTTypeImage, unicode)
+        self.assertIsInstance(kUTTypeJPEG, unicode)
+        self.assertIsInstance(kUTTypeJPEG2000, unicode)
+        self.assertIsInstance(kUTTypeTIFF, unicode)
+        self.assertIsInstance(kUTTypePICT, unicode)
+        self.assertIsInstance(kUTTypeGIF, unicode)
+        self.assertIsInstance(kUTTypePNG, unicode)
+        self.assertIsInstance(kUTTypeQuickTimeImage, unicode)
+        self.assertIsInstance(kUTTypeAppleICNS, unicode)
+        self.assertIsInstance(kUTTypeBMP, unicode)
+        self.assertIsInstance(kUTTypeICO, unicode)
+        self.assertIsInstance(kUTTypeAudiovisualContent, unicode)
+        self.assertIsInstance(kUTTypeMovie, unicode)
+        self.assertIsInstance(kUTTypeVideo, unicode)
+        self.assertIsInstance(kUTTypeAudio, unicode)
+        self.assertIsInstance(kUTTypeQuickTimeMovie, unicode)
+        self.assertIsInstance(kUTTypeMPEG, unicode)
+        self.assertIsInstance(kUTTypeMPEG4, unicode)
+        self.assertIsInstance(kUTTypeMP3, unicode)
+        self.assertIsInstance(kUTTypeMPEG4Audio, unicode)
+        self.assertIsInstance(kUTTypeAppleProtectedMPEG4Audio, unicode)
+        self.assertIsInstance(kUTTypeFolder, unicode)
+        self.assertIsInstance(kUTTypeVolume, unicode)
+        self.assertIsInstance(kUTTypePackage, unicode)
+        self.assertIsInstance(kUTTypeBundle, unicode)
+        self.assertIsInstance(kUTTypeFramework, unicode)
+        self.assertIsInstance(kUTTypeApplicationBundle, unicode)
+        self.assertIsInstance(kUTTypeApplicationFile, unicode)
+        self.assertIsInstance(kUTTypeVCard, unicode)
+        self.assertIsInstance(kUTTypeInkText, unicode)
 
 if __name__ == "__main__":
     main()

pyobjc-framework-LaunchServices/PyObjCTest/test_uttype.py

 
 class TestUTType (TestCase):
     def testConstants(self):
-        self.failUnlessIsInstance(kUTExportedTypeDeclarationsKey, unicode)
-        self.failUnlessIsInstance(kUTImportedTypeDeclarationsKey, unicode)
-        self.failUnlessIsInstance(kUTTypeIdentifierKey, unicode)
-        self.failUnlessIsInstance(kUTTypeTagSpecificationKey, unicode)
-        self.failUnlessIsInstance(kUTTypeConformsToKey, unicode)
-        self.failUnlessIsInstance(kUTTypeDescriptionKey, unicode)
-        self.failUnlessIsInstance(kUTTypeIconFileKey, unicode)
-        self.failUnlessIsInstance(kUTTypeReferenceURLKey, unicode)
-        self.failUnlessIsInstance(kUTTypeVersionKey, unicode)
-        self.failUnlessIsInstance(kUTTagClassFilenameExtension, unicode)
-        self.failUnlessIsInstance(kUTTagClassMIMEType, unicode)
-        self.failUnlessIsInstance(kUTTagClassNSPboardType, unicode)
-        self.failUnlessIsInstance(kUTTagClassOSType, unicode)
+        self.assertIsInstance(kUTExportedTypeDeclarationsKey, unicode)
+        self.assertIsInstance(kUTImportedTypeDeclarationsKey, unicode)
+        self.assertIsInstance(kUTTypeIdentifierKey, unicode)
+        self.assertIsInstance(kUTTypeTagSpecificationKey, unicode)
+        self.assertIsInstance(kUTTypeConformsToKey, unicode)
+        self.assertIsInstance(kUTTypeDescriptionKey, unicode)
+        self.assertIsInstance(kUTTypeIconFileKey, unicode)
+        self.assertIsInstance(kUTTypeReferenceURLKey, unicode)
+        self.assertIsInstance(kUTTypeVersionKey, unicode)
+        self.assertIsInstance(kUTTagClassFilenameExtension, unicode)
+        self.assertIsInstance(kUTTagClassMIMEType, unicode)
+        self.assertIsInstance(kUTTagClassNSPboardType, unicode)
+        self.assertIsInstance(kUTTagClassOSType, unicode)
 
     def testFunctions(self):
-        self.failUnlessResultIsCFRetained(UTTypeCreatePreferredIdentifierForTag)
+        self.assertResultIsCFRetained(UTTypeCreatePreferredIdentifierForTag)
         v = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, "py", kUTTypePlainText)
-        self.failUnlessIsInstance(v, unicode)
+        self.assertIsInstance(v, unicode)
 
-        self.failUnlessResultIsCFRetained(UTTypeCreateAllIdentifiersForTag)
+        self.assertResultIsCFRetained(UTTypeCreateAllIdentifiersForTag)
         v = UTTypeCreateAllIdentifiersForTag(kUTTagClassFilenameExtension, "py", kUTTypePlainText)
-        self.failUnlessIsInstance(v, CFArrayRef)
-        self.failUnless(len(v) >= 1)
-        self.failUnlessIsInstance(v[0], unicode)
+        self.assertIsInstance(v, CFArrayRef)
+        self.assertGreaterEqual(len(v), 1)
+        self.assertIsInstance(v[0], unicode)
 
-        self.failUnlessResultIsCFRetained(UTTypeCopyPreferredTagWithClass)
+        self.assertResultIsCFRetained(UTTypeCopyPreferredTagWithClass)
         v = UTTypeCopyPreferredTagWithClass("public.python-script", kUTTagClassFilenameExtension)
-        self.failUnlessIsInstance(v, unicode)
+        self.assertIsInstance(v, unicode)
 
-        self.failUnlessResultIsBOOL(UTTypeEqual)
+        self.assertResultIsBOOL(UTTypeEqual)
         v = UTTypeEqual("public.python-script", "public.python-script")
-        self.failUnless(v is True)
+        self.assertIsObject(v, True)
 
-        self.failUnlessResultIsBOOL(UTTypeConformsTo)
+        self.assertResultIsBOOL(UTTypeConformsTo)
         v = UTTypeConformsTo("public.python-script", kUTTypePlainText)
-        self.failUnless(v is True)
+        self.assertIsObject(v, True)
 
-        self.failUnlessResultIsCFRetained(UTTypeCopyDescription)
+        self.assertResultIsCFRetained(UTTypeCopyDescription)
         v = UTTypeCopyDescription(kUTTypePlainText)
-        self.failUnlessIsInstance(v, unicode)
+        self.assertIsInstance(v, unicode)
 
-        self.failUnlessResultIsCFRetained(UTTypeCopyDeclaration)
+        self.assertResultIsCFRetained(UTTypeCopyDeclaration)
         v = UTTypeCopyDeclaration(kUTTypePlainText)
-        self.failUnlessIsInstance(v, CFDictionaryRef)
+        self.assertIsInstance(v, CFDictionaryRef)
 
-        self.failUnlessResultIsCFRetained(UTTypeCopyDeclaringBundleURL)
+        self.assertResultIsCFRetained(UTTypeCopyDeclaringBundleURL)
         v = UTTypeCopyDeclaringBundleURL(kUTTypePlainText)
-        self.failUnlessIsInstance(v, CFURLRef)
+        self.assertIsInstance(v, CFURLRef)
 
-        self.failUnlessResultIsCFRetained(UTCreateStringForOSType)
+        self.assertResultIsCFRetained(UTCreateStringForOSType)
         v = UTCreateStringForOSType(24353)
-        self.failUnlessIsInstance(v, unicode)
+        self.assertIsInstance(v, unicode)
 
         v = UTGetOSTypeFromString(v)
-        self.failUnlessEqual(v, 24353)
+        self.assertEqual(v, 24353)
         
 
 

pyobjc-framework-LaunchServices/distribute_setup.py

+#!python
+"""Bootstrap distribute installation
+
+If you want to use setuptools in your package's setup.py, just include this
+file in the same directory with it, and add this to the top of your setup.py::
+
+    from distribute_setup import use_setuptools
+    use_setuptools()
+
+If you want to require a specific version of setuptools, set a download
+mirror, or use an alternate download directory, you can do so by supplying
+the appropriate options to ``use_setuptools()``.
+
+This file can also be run as a script to install or upgrade setuptools.
+"""
+import os
+import sys
+import time
+import fnmatch
+import tempfile
+import tarfile
+from distutils import log
+
+try:
+    from site import USER_SITE
+except ImportError:
+    USER_SITE = None
+
+try:
+    import subprocess
+
+    def _python_cmd(*args):
+        args = (sys.executable,) + args
+        return subprocess.call(args) == 0
+
+except ImportError:
+    # will be used for python 2.3
+    def _python_cmd(*args):
+        args = (sys.executable,) + args
+        # quoting arguments if windows
+        if sys.platform == 'win32':
+            def quote(arg):
+                if ' ' in arg:
+                    return '"%s"' % arg
+                return arg
+            args = [quote(arg) for arg in args]
+        return os.spawnl(os.P_WAIT, sys.executable, *args) == 0
+
+DEFAULT_VERSION = "0.6.8"
+DEFAULT_URL = "http://pypi.python.org/packages/source/d/distribute/"
+SETUPTOOLS_PKG_INFO = """\
+Metadata-Version: 1.0
+Name: setuptools
+Version: 0.6c9
+Summary: xxxx
+Home-page: xxx
+Author: xxx
+Author-email: xxx
+License: xxx
+Description: xxx
+"""
+
+
+def _install(tarball):
+    # extracting the tarball
+    tmpdir = tempfile.mkdtemp()
+    log.warn('Extracting in %s', tmpdir)
+    old_wd = os.getcwd()
+    try:
+        os.chdir(tmpdir)
+        tar = tarfile.open(tarball)
+        _extractall(tar)
+        tar.close()
+
+        # going in the directory
+        subdir = os.path.join(tmpdir, os.listdir(tmpdir)[0])
+        os.chdir(subdir)
+        log.warn('Now working in %s', subdir)
+
+        # installing
+        log.warn('Installing Distribute')
+        assert _python_cmd('setup.py', 'install')
+    finally:
+        os.chdir(old_wd)
+
+
+def _build_egg(egg, tarball, to_dir):
+    # extracting the tarball
+    tmpdir = tempfile.mkdtemp()
+    log.warn('Extracting in %s', tmpdir)
+    old_wd = os.getcwd()
+    try:
+        os.chdir(tmpdir)
+        tar = tarfile.open(tarball)
+        _extractall(tar)
+        tar.close()
+
+        # going in the directory
+        subdir = os.path.join(tmpdir, os.listdir(tmpdir)[0])
+        os.chdir(subdir)
+        log.warn('Now working in %s', subdir)
+
+        # building an egg
+        log.warn('Building a Distribute egg in %s', to_dir)
+        _python_cmd('setup.py', '-q', 'bdist_egg', '--dist-dir', to_dir)
+
+    finally:
+        os.chdir(old_wd)
+    # returning the result
+    log.warn(egg)
+    if not os.path.exists(egg):
+        raise IOError('Could not build the egg.')
+
+
+def _do_download(version, download_base, to_dir, download_delay):
+    egg = os.path.join(to_dir, 'distribute-%s-py%d.%d.egg'
+                       % (version, sys.version_info[0], sys.version_info[1]))
+    if not os.path.exists(egg):
+        tarball = download_setuptools(version, download_base,
+                                      to_dir, download_delay)
+        _build_egg(egg, tarball, to_dir)
+    sys.path.insert(0, egg)
+    import setuptools
+    setuptools.bootstrap_install_from = egg
+
+
+def use_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,
+                   to_dir=os.curdir, download_delay=15, no_fake=True):
+    # making sure we use the absolute path
+    to_dir = os.path.abspath(to_dir)
+    was_imported = 'pkg_resources' in sys.modules or \
+        'setuptools' in sys.modules
+    try:
+        try:
+            import pkg_resources
+            if not hasattr(pkg_resources, '_distribute'):
+                if not no_fake:
+                    _fake_setuptools()
+                raise ImportError
+        except ImportError:
+            return _do_download(version, download_base, to_dir, download_delay)
+        try:
+            pkg_resources.require("distribute>="+version)
+            return
+        except pkg_resources.VersionConflict:
+            e = sys.exc_info()[1]
+            if was_imported:
+                sys.stderr.write(
+                "The required version of distribute (>=%s) is not available,\n"
+                "and can't be installed while this script is running. Please\n"
+                "install a more recent version first, using\n"
+                "'easy_install -U distribute'."
+                "\n\n(Currently using %r)\n" % (version, e.args[0]))
+                sys.exit(2)
+            else:
+                del pkg_resources, sys.modules['pkg_resources']    # reload ok
+                return _do_download(version, download_base, to_dir,
+                                    download_delay)
+        except pkg_resources.DistributionNotFound:
+            return _do_download(version, download_base, to_dir,
+                                download_delay)
+    finally:
+        if not no_fake:
+            _create_fake_setuptools_pkg_info(to_dir)
+
+def download_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,
+                        to_dir=os.curdir, delay=15):
+    """Download distribute from a specified location and return its filename
+
+    `version` should be a valid distribute version number that is available
+    as an egg for download under the `download_base` URL (which should end
+    with a '/'). `to_dir` is the directory where the egg will be downloaded.
+    `delay` is the number of seconds to pause before an actual download
+    attempt.
+    """
+    # making sure we use the absolute path
+    to_dir = os.path.abspath(to_dir)
+    try:
+        from urllib.request import urlopen
+    except ImportError:
+        from urllib2 import urlopen
+    tgz_name = "distribute-%s.tar.gz" % version
+    url = download_base + tgz_name
+    saveto = os.path.join(to_dir, tgz_name)
+    src = dst = None
+    if not os.path.exists(saveto):  # Avoid repeated downloads
+        try:
+            log.warn("Downloading %s", url)
+            src = urlopen(url)
+            # Read/write all in one block, so we don't create a corrupt file
+            # if the download is interrupted.
+            data = src.read()
+            dst = open(saveto, "wb")
+            dst.write(data)
+        finally:
+            if src:
+                src.close()
+            if dst:
+                dst.close()
+    return os.path.realpath(saveto)
+
+
+def _patch_file(path, content):
+    """Will backup the file then patch it"""
+    existing_content = open(path).read()
+    if existing_content == content:
+        # already patched
+        log.warn('Already patched.')
+        return False
+    log.warn('Patching...')
+    _rename_path(path)
+    f = open(path, 'w')
+    try:
+        f.write(content)
+    finally:
+        f.close()
+    return True
+
+
+def _same_content(path, content):
+    return open(path).read() == content
+
+
+def _rename_path(path):
+    new_name = path + '.OLD.%s' % time.time()
+    log.warn('Renaming %s into %s', path, new_name)
+    try:
+        from setuptools.sandbox import DirectorySandbox
+        def _violation(*args):
+            pass
+        DirectorySandbox._violation = _violation
+    except ImportError:
+        pass
+
+    os.rename(path, new_name)
+    return new_name
+
+
+def _remove_flat_installation(placeholder):
+    if not os.path.isdir(placeholder):
+        log.warn('Unkown installation at %s', placeholder)
+        return False
+    found = False
+    for file in os.listdir(placeholder):
+        if fnmatch.fnmatch(file, 'setuptools*.egg-info'):
+            found = True
+            break
+    if not found:
+        log.warn('Could not locate setuptools*.egg-info')
+        return
+
+    log.warn('Removing elements out of the way...')
+    pkg_info = os.path.join(placeholder, file)
+    if os.path.isdir(pkg_info):
+        patched = _patch_egg_dir(pkg_info)
+    else:
+        patched = _patch_file(pkg_info, SETUPTOOLS_PKG_INFO)
+
+    if not patched:
+        log.warn('%s already patched.', pkg_info)
+        return False
+    # now let's move the files out of the way
+    for element in ('setuptools', 'pkg_resources.py', 'site.py'):
+        element = os.path.join(placeholder, element)
+        if os.path.exists(element):
+            _rename_path(element)
+        else:
+            log.warn('Could not find the %s element of the '
+                     'Setuptools distribution', element)
+    return True
+
+
+def _after_install(dist):
+    log.warn('After install bootstrap.')
+    placeholder = dist.get_command_obj('install').install_purelib
+    _create_fake_setuptools_pkg_info(placeholder)
+
+def _create_fake_setuptools_pkg_info(placeholder):
+    if not placeholder or not os.path.exists(placeholder):
+        log.warn('Could not find the install location')
+        return
+    pyver = '%s.%s' % (sys.version_info[0], sys.version_info[1])
+    setuptools_file = 'setuptools-0.6c9-py%s.egg-info' % pyver
+    pkg_info = os.path.join(placeholder, setuptools_file)
+    if os.path.exists(pkg_info):
+        log.warn('%s already exists', pkg_info)
+        return
+    log.warn('Creating %s', pkg_info)
+    f = open(pkg_info, 'w')
+    try:
+        f.write(SETUPTOOLS_PKG_INFO)
+    finally:
+        f.close()
+    pth_file = os.path.join(placeholder, 'setuptools.pth')
+    log.warn('Creating %s', pth_file)
+    f = open(pth_file, 'w')
+    try:
+        f.write(os.path.join(os.curdir, setuptools_file))
+    finally:
+        f.close()
+
+
+def _patch_egg_dir(path):
+    # let's check if it's already patched
+    pkg_info = os.path.join(path, 'EGG-INFO', 'PKG-INFO')
+    if os.path.exists(pkg_info):
+        if _same_content(pkg_info, SETUPTOOLS_PKG_INFO):
+            log.warn('%s already patched.', pkg_info)
+            return False
+    _rename_path(path)
+    os.mkdir(path)
+    os.mkdir(os.path.join(path, 'EGG-INFO'))
+    pkg_info = os.path.join(path, 'EGG-INFO', 'PKG-INFO')
+    f = open(pkg_info, 'w')
+    try:
+        f.write(SETUPTOOLS_PKG_INFO)
+    finally:
+        f.close()
+    return True
+
+
+def _before_install():
+    log.warn('Before install bootstrap.')
+    _fake_setuptools()
+
+
+def _under_prefix(location):
+    if 'install' not in sys.argv:
+        return True
+    args = sys.argv[sys.argv.index('install')+1:]
+    for index, arg in enumerate(args):
+        for option in ('--root', '--prefix'):
+            if arg.startswith('%s=' % option):
+                top_dir = arg.split('root=')[-1]
+                return location.startswith(top_dir)
+            elif arg == option:
+                if len(args) > index:
+                    top_dir = args[index+1]
+                    return location.startswith(top_dir)
+            elif option == '--user' and USER_SITE is not None:
+                return location.startswith(USER_SITE)
+    return True
+
+
+def _fake_setuptools():
+    log.warn('Scanning installed packages')
+    try:
+        import pkg_resources
+    except ImportError:
+        # we're cool
+        log.warn('Setuptools or Distribute does not seem to be installed.')
+        return
+    ws = pkg_resources.working_set
+    try:
+        setuptools_dist = ws.find(pkg_resources.Requirement.parse('setuptools',
+                                  replacement=False))
+    except TypeError:
+        # old distribute API
+        setuptools_dist = ws.find(pkg_resources.Requirement.parse('setuptools'))
+
+    if setuptools_dist is None:
+        log.warn('No setuptools distribution found')
+        return
+    # detecting if it was already faked
+    setuptools_location = setuptools_dist.location
+    log.warn('Setuptools installation detected at %s', setuptools_location)
+
+    # if --root or --preix was provided, and if
+    # setuptools is not located in them, we don't patch it
+    if not _under_prefix(setuptools_location):
+        log.warn('Not patching, --root or --prefix is installing Distribute'
+                 ' in another location')
+        return
+
+    # let's see if its an egg
+    if not setuptools_location.endswith('.egg'):
+        log.warn('Non-egg installation')
+        res = _remove_flat_installation(setuptools_location)
+        if not res:
+            return
+    else:
+        log.warn('Egg installation')
+        pkg_info = os.path.join(setuptools_location, 'EGG-INFO', 'PKG-INFO')
+        if (os.path.exists(pkg_info) and
+            _same_content(pkg_info, SETUPTOOLS_PKG_INFO)):
+            log.warn('Already patched.')
+            return
+        log.warn('Patching...')
+        # let's create a fake egg replacing setuptools one
+        res = _patch_egg_dir(setuptools_location)
+        if not res:
+            return
+    log.warn('Patched done.')
+    _relaunch()
+
+
+def _relaunch():
+    log.warn('Relaunching...')
+    # we have to relaunch the process
+    args = [sys.executable] + sys.argv
+    sys.exit(subprocess.call(args))
+
+
+def _extractall(self, path=".", members=None):
+    """Extract all members from the archive to the current working
+       directory and set owner, modification time and permissions on
+       directories afterwards. `path' specifies a different directory
+       to extract to. `members' is optional and must be a subset of the
+       list returned by getmembers().
+    """
+    import copy
+    import operator
+    from tarfile import ExtractError
+    directories = []
+
+    if members is None:
+        members = self
+
+    for tarinfo in members:
+        if tarinfo.isdir():
+            # Extract directories with a safe mode.
+            directories.append(tarinfo)
+            tarinfo = copy.copy(tarinfo)
+            tarinfo.mode = 448 # decimal for oct 0700
+        self.extract(tarinfo, path)
+
+    # Reverse sort directories.
+    if sys.version_info < (2, 4):
+        def sorter(dir1, dir2):
+            return cmp(dir1.name, dir2.name)
+        directories.sort(sorter)
+        directories.reverse()
+    else:
+        directories.sort(key=operator.attrgetter('name'), reverse=True)
+
+    # Set correct owner, mtime and filemode on directories.
+    for tarinfo in directories:
+        dirpath = os.path.join(path, tarinfo.name)
+        try:
+            self.chown(tarinfo, dirpath)
+            self.utime(tarinfo, dirpath)
+            self.chmod(tarinfo, dirpath)
+        except ExtractError:
+            e = sys.exc_info()[1]
+            if self.errorlevel > 1:
+                raise
+            else:
+                self._dbg(1, "tarfile: %s" % e)
+
+
+def main(argv, version=DEFAULT_VERSION):
+    """Install or upgrade setuptools and EasyInstall"""
+    tarball = download_setuptools()
+    _install(tarball)
+
+
+if __name__ == '__main__':
+    main(sys.argv[1:])

pyobjc-framework-LaunchServices/pyobjc_setup.py

 
 __all__ = ('setup', 'Extension', 'Command')
 
-import ez_setup
-ez_setup.use_setuptools()
+import sys
+if sys.version_info[:2] < (3, 0):
+    import ez_setup
+    ez_setup.use_setuptools()
+
+    from setuptools.command.test import test as oc_test
+    from setuptools.command.build_py import build_py as oc_build_py
+
+    extra_args = {}
+
+
+else:
+    import distribute_setup
+    distribute_setup.use_setuptools()
+
+    from setuptools.command import test
+    from setuptools.command import build_py
+
+    from distutils import log
+
+    extra_args=dict(
+        use_2to3 = True,
+    )
+
+
+    class oc_build_py (build_py.build_py):
+        def build_packages(self):
+            log.info("Overriding build_packages to copy PyObjCTest")
+            p = self.packages
+            self.packages = list(self.packages) + ['PyObjCTest']
+            try:
+                build_py.build_py.build_packages(self)
+            finally:
+                self.packages = p
+
+
+
+    class oc_test (test.test):
+        def run_tests(self):
+            import sys, os
+
+            rootdir =  os.path.dirname(os.path.abspath(__file__))
+            if rootdir in sys.path:
+                sys.path.remove(rootdir)
+
+            import PyObjCTest
+            import unittest
+            from pkg_resources import EntryPoint
+            loader_ep = EntryPoint.parse("x="+self.test_loader)
+            loader_class = loader_ep.load(require=False)
+
+            unittest.main(None, None, [unittest.__file__]+self.test_args, testLoader=loader_class())
+
+
 
 from setuptools import setup as _setup, Extension as _Extension, Command
 from distutils.errors import DistutilsPlatformError
 from distutils.command import build, install, install_lib
 from setuptools.command import develop, test, build_ext
+import pkg_resources
+import shutil
+import os
 import plistlib
 import sys
 import __main__
 
 class pyobjc_build_ext (build_ext.build_ext):
     def run(self):
+
+        # Ensure that the PyObjC header files are available
+        # in 2.3 and later the headers are in the egg,
+        # before that we ship a copy.
+        dist, = pkg_resources.require('pyobjc-core')
+
+        include_root = os.path.join(self.build_temp, 'pyobjc-include')
+        if os.path.exists(include_root):
+            shutil.rmtree(include_root)
+
+        os.makedirs(include_root)
+        if dist.has_metadata('include'):
+            for fn in dist.metadata_listdir('include'):
+                data = dist.get_metadata('include/%s'%(fn,))
+                open(os.path.join(include_root, fn), 'w').write(data)
+
+        else:
+            data = gPyObjCAPI_H
+            open(os.path.join(include_rot, 'pyobjc-api.h'), 'w').write(data)
+
+        for e in self.extensions:
+            if include_root not in e.include_dirs:
+                e.include_dirs.append(include_root)
+
+        # Run the actual build
         build_ext.build_ext.run(self)
+
+        # Then tweak the copy_extensions bit to ensure PyObjCTest gets
+        # copied to the right place.
         extensions = self.extensions
         self.extensions = [
             e for e in extensions if e.name.startswith('PyObjCTest') ]