@@ -0,0 +1,2618 @@
+#!/usr/bin/env python%0A#%0A# Copyright 2010 Per Olofsson%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the License at%0A#%0A#     http://www.apache.org/licenses/LICENSE-2.0%0A#%0A# Unless required by applicable law or agreed to in writing, software%0A# distributed under the License is distributed on an %22AS IS%22 BASIS,%0A# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A# See the License for the specific language governing permissions and%0A# limitations under the License.%0A%0A%0Aimport re%0Aimport urllib2%0A%0Afrom autopkglib import Processor, ProcessorError%0A%0A%0A__all__ = %5B%22AdobeFlashURLProvider%22%5D%0A%0A%0AADOBEFLASH_BASE_URL = %22http://get.adobe.com/flashplayer/completion/?installer=Flash_Player_11_for_Mac_OS_X_10.6_-_10.9%22%0A#re_adobeflash_ver = re.compile(r'Adobe Flash Player %5CS+ version (?P%3Cversion%3E%5B%5Cd.%5D+)', re.I)%0Are_adobeflash_dmg = re.compile(r'(?P%3Curl%3Ehttp://fpdownload.macromedia.com/get/flashplayer/pdc/%5B%5Cd.%5D+/install_flash_player_osx.dmg)', re.I)%0A%0Aclass AdobeFlashURLProvider(Processor):%0A    description = %22Provides URL to the latest Adobe Flash Player release.%22%0A    input_variables = %7B%0A        %22base_url%22: %7B%0A            %22required%22: False,%0A            %22description%22: %22Default is '%25s'.%22 %25 ADOBEFLASH_BASE_URL,%0A        %7D,%0A    %7D%0A    output_variables = %7B%0A        %22url%22: %7B%0A            %22description%22: %22URL to the latest Adobe Flash Player release.%22,%0A        %7D,%0A    %7D%0A    %0A    __doc__ = description%0A    %0A    def get_adobeflash_dmg_url(self, base_url):%0A        # Read HTML index.%0A        try:%0A            f = urllib2.urlopen(base_url)%0A            html = f.read()%0A            f.close()%0A        except BaseException as e:%0A            raise ProcessorError(%22Can't download %25s: %25s%22 %25 (base_url, e))%0A        %0A        # Search for download link.%0A        m = re_adobeflash_dmg.search(html)%0A        if not m:%0A            raise ProcessorError(%22Couldn't find Adobe Flash Player download URL in %25s%22 %25 base_url)%0A        %0A        # Return URL.%0A        return m.group(%22url%22)%0A        #return %22http://fpdownload.macromedia.com/get/flashplayer/pdc/%25s/install_flash_player_osx.dmg%22 %25 m.group(%22ver%22)%0A    %0A    def main(self):%0A        # Determine base_url.%0A        if %22base_url%22 in self.env:%0A            base_url = self.env.base_url%0A        else:%0A            base_url = ADOBEFLASH_BASE_URL%0A        %0A        self.env%5B%22url%22%5D = self.get_adobeflash_dmg_url(base_url)%0A        self.output(%22Found URL %25s%22 %25 self.env%5B%22url%22%5D)%0A    %0A%0Aif __name__ == '__main__':%0A    processor = AdobeFlashURLProvider()%0A    processor.execute_shell()%0A    %0A%0A

Move AdobeFlashURLProvider.py to recipe's directory