Ejemplo n.º 1
0
    def make(self):
        helper_in_cwd = exists(join(self.dir, "googlecode_upload.py"))
        if helper_in_cwd:
            sys.path.insert(0, self.dir)
        try:
            import googlecode_upload
        except ImportError:
            raise MkError("couldn't import `googlecode_upload` (get it from http://support.googlecode.com/svn/trunk/scripts/googlecode_upload.py)")
        if helper_in_cwd:
            del sys.path[0]

        ver = _get_version()
        sdist_path = join(self.dir, "dist", "go-%s.zip" % ver)
        status, reason, url = googlecode_upload.upload_find_auth(
            sdist_path,
            "go-tool", # project_name
            "go %s source package" % ver, # summary
            ["Featured", "Type-Archive"]) # labels
        if not url:
            raise MkError("couldn't upload sdist to Google Code: %s (%s)"
                          % (reason, status))
        self.log.info("uploaded sdist to `%s'", url)

        project_url = "http://code.google.com/p/go-tool/"
        import webbrowser
        webbrowser.open_new(project_url)
Ejemplo n.º 2
0
  def run(self):
    name = self.distribution.get_name()
    version = self.distribution.get_version()

    if self.src:
      # TODO(epg): sdist is more flexible with formats...
      fn = os.path.join(self.dist_dir, self.distribution.get_fullname())
      if sys.platform == 'win32':
        fn += '.zip'
      else:
        fn += '.tar.gz'
      summary = ' '.join([name, version, 'source distribution'])
      labels = SOURCE_LABELS
    else:
      # Get filename from bdist_wininst.
      bd = distutils.command.bdist_wininst.bdist_wininst(self.distribution)
      bd.initialize_options()
      bd.dist_dir = self.dist_dir
      bd.finalize_options()
      fn = bd.get_installer_filename(self.distribution.get_fullname())
      summary = ' '.join([name, version, 'for Windows'])
      labels = WINDOWS_LABELS

    (status, reason,
     file_url) = googlecode_upload.upload_find_auth(fn, name, summary,
                                                    labels, self.config_dir,
                                                    self.user)

    if file_url is None:
      sys.stderr.write('error: %s (%d)\n' % (reason, status))
      sys.exit(2)

    sys.stdout.write('Uploaded %s\n' % (file_url,))
Ejemplo n.º 3
0
def main(argv=None):
  if argv is None:
    argv = sys.argv

  if not len(argv) is 2:
    print >> sys.stderr, 'Usage: %s release_version' % sys.argv[0].split("/")[-1]
    return 2
  version = argv[1]
  if not _VERSION_RE.match(version):
    print >> sys.stderr, 'Invalid version string: %s' % version
    return 2

  if not CheckRepositoryStatus(version):
    return 2

  epgp_root = util.FindAddonRootDir('epgp')
  epgp_toc = os.path.join(epgp_root, 'epgp.toc')
  logging.info('Updating %s with version info' % epgp_toc)
  if not UpdateToc(epgp_toc, version):
    logging.info('Version did not change, cannot commit')

  tmp_dir = tempfile.mkdtemp()
  logging.info('Temporary directory: %s' % tmp_dir)
  stage_dir = os.path.join(tmp_dir, 'epgp')
  logging.info('Stage directory: %s' % stage_dir)
  zip_name = os.path.join(tmp_dir, 'epgp-%s.zip' % version)
  logging.info('Release zip location: %s' % zip_name)

  logging.info('Copying %s to %s', epgp_root, stage_dir)
  CopyAddonDirectory(epgp_root, stage_dir)

  logging.info('Making the release zip: %s' % zip_name)
  zip_file = zipfile.ZipFile(zip_name, 'w')
  for file in ListFiles(stage_dir):
    arc_name = 'epgp' + file[len(stage_dir):]
    zip_file.write(file, arc_name, compress_type=zipfile.ZIP_DEFLATED)
  zip_file.close()

  subprocess.Popen(['git', 'tag', "v%s" % version],
                   stdout=sys.stdout, stderr=sys.stderr).communicate()

  r = raw_input('Do you want to upload the zip [y/N]? ')
  if r in ('y', 'Y'):
    sys.path.append(os.path.join(os.path.dirname(__file__), 'googlecode'))
    from googlecode_upload import upload_find_auth
    status, reason, url = upload_find_auth(
      zip_name, 'epgp', 'epgp-%s' % version, ['Featured'])
    if url:
      print('The zip was uploaded successfully.')
      print('URL: %s' % url)
    else:
      print('An error occurred. The zip was not uploaded.')
      print('Google Code upload server said: %s (%s)' % (reason, status))
Ejemplo n.º 4
0
    def _uploadGoogleCode(self, fp):
        summary = athenaObj.athVersion
        project = 'athenacl'
        user = '******'

        if fp.endswith('.tar.gz'):
            labels = ['OpSys-All', 'Featured', 'Type-Archive']
        elif fp.endswith('.exe'):
            labels = ['OpSys-Windows', 'Featured', 'Type-Installer']
        elif fp.endswith('.egg'):
            labels = ['OpSys-All', 'Featured', 'Type-Archive']

        environment.printWarn(['starting GoogleCode upload of:', fp])
        status, reason, url = googlecode_upload.upload_find_auth(
            fp, project, summary, labels, user)
        environment.printWarn([status, reason])
Ejemplo n.º 5
0
    def _uploadGoogleCode(self, fp):
        summary = athenaObj.athVersion
        project = 'athenacl'
        user = '******'

        if fp.endswith('.tar.gz'):
            labels = ['OpSys-All', 'Featured', 'Type-Archive']
        elif fp.endswith('.exe'):
            labels = ['OpSys-Windows', 'Featured', 'Type-Installer']
        elif fp.endswith('.egg'):
            labels = ['OpSys-All', 'Featured', 'Type-Archive']
    
        environment.printWarn(['starting GoogleCode upload of:', fp])
        status, reason, url = googlecode_upload.upload_find_auth(fp, 
                        project, summary, labels, user)
        environment.printWarn([status, reason])
Ejemplo n.º 6
0
def upload_installer(version, architecture):
    """Upload to WinPython GoogleCode project"""
    assert architecture in (32, 64)
    file_path = osp.join(make.get_basedir(version), "build",
                         "WinPython-%dbit-%s.exe" % (architecture, version))
    summary = "WinPython %dbit %s" % (architecture, version)
    
    user, password = get_hg_user_password()
    labels = ["Featured", "Type-Installer", "OpSys-Windows"]
    
    status, reason, url = gu.upload_find_auth(file_path, "winpython",
                                              summary, labels, user, password)
    if url:
        print('Uploaded: %s' % url)
    else:
        print('An error occurred. Your file was not uploaded.',
              file=sys.stderr)
        print('Google Code upload server said: %s (%s)' % (reason, status),
              file=sys.stderr)
Ejemplo n.º 7
0
    def uploadGoogleCodeOneFile(self, fp):
        """Upload distributions to Google code. Requires googlecode_upload.py script from: 
        http://code.google.com/p/support/source/browse/trunk/scripts/googlecode_upload.py
        """
        import googlecode_upload  # placed in site-packages

        summary = self.version
        project = "music21"
        user = "******"

        if fp.endswith(".tar.gz"):
            labels = ["OpSys-All", "Featured", "Type-Archive"]
        elif fp.endswith(".exe"):
            labels = ["OpSys-Windows", "Featured", "Type-Installer"]
        elif fp.endswith(".egg"):
            labels = ["OpSys-All", "Featured", "Type-Archive"]

        print(["starting GoogleCode upload of:", fp])
        status, reason, unused_url = googlecode_upload.upload_find_auth(fp, project, summary, labels, user)
        print([status, reason])
Ejemplo n.º 8
0
    def uploadGoogleCodeOneFile(self, fp):
        '''Upload distributions to Google code. Requires googlecode_upload.py script from: 
        http://code.google.com/p/support/source/browse/trunk/scripts/googlecode_upload.py
        '''
        import googlecode_upload  # placed in site-packages

        summary = self.version
        project = 'music21'
        user = '******'

        if fp.endswith('.tar.gz'):
            labels = ['OpSys-All', 'Featured', 'Type-Archive']
        elif fp.endswith('.exe'):
            labels = ['OpSys-Windows', 'Featured', 'Type-Installer']
        elif fp.endswith('.egg'):
            labels = ['OpSys-All', 'Featured', 'Type-Archive']

        print(['starting GoogleCode upload of:', fp])
        status, reason, unused_url = googlecode_upload.upload_find_auth(
            fp, project, summary, labels, user)
        print([status, reason])
Ejemplo n.º 9
0
    def uploadGoogleCodeOneFile(self, fp):
        '''Upload distributions to Google code. Requires googlecode_upload.py script from: 
        http://code.google.com/p/support/source/browse/trunk/scripts/googlecode_upload.py
        '''
        import googlecode_upload # placed in site-packages

        summary = self.version
        project = 'music21'
        user = '******'

        if fp.endswith('.tar.gz'):
            labels = ['OpSys-All', 'Featured', 'Type-Archive']
        elif fp.endswith('.exe'):
            labels = ['OpSys-Windows', 'Featured', 'Type-Installer']
        elif fp.endswith('.egg'):
            labels = ['OpSys-All', 'Featured', 'Type-Archive']
        
        print(['starting GoogleCode upload of:', fp])
        status, reason, unused_url = googlecode_upload.upload_find_auth(fp, 
                        project, summary, labels, user)
        print([status, reason])
Ejemplo n.º 10
0
    def make(self):
        try:
            import googlecode_upload
        except ImportError:
            raise MkError("couldn't import `googlecode_upload` (get it from http://support.googlecode.com/svn/trunk/scripts/googlecode_upload.py)")

        ver = _get_version()
        sdist_path = join(self.dir, "dist", "preprocess-%s.zip" % ver)
        status, reason, url = googlecode_upload.upload_find_auth(
            sdist_path,
            "preprocess", # project_name
            "preprocess %s source package" % ver, # summary
            ["Featured", "Type-Archive"]) # labels
        if not url:
            raise MkError("couldn't upload sdsit to Google Code: %s (%s)"
                          % (reason, status))
        self.log.info("uploaded sdist to `%s'", url)

        project_url = "http://code.google.com/p/preprocess/"
        import webbrowser
        webbrowser.open_new(project_url)
Ejemplo n.º 11
0
    def make(self):
        try:
            import googlecode_upload
        except ImportError:
            raise MkError("couldn't import `googlecode_upload` (get it from http://support.googlecode.com/svn/trunk/scripts/googlecode_upload.py)")

        ver = _get_version()
        sdist_path = join(self.dir, "dist", "cmdln-%s.zip" % ver)
        status, reason, url = googlecode_upload.upload_find_auth(
            sdist_path,
            "cmdln", # project_name
            "cmdln %s source package" % ver, # summary
            ["Featured", "Type-Archive"]) # labels
        if not url:
            raise MkError("couldn't upload sdsit to Google Code: %s (%s)"
                          % (reason, status))
        self.log.info("uploaded sdist to `%s'", url)

        project_url = "http://code.google.com/p/cmdln/"
        import webbrowser
        webbrowser.open_new(project_url)
Ejemplo n.º 12
0
    def run(self):
        # TODO(pts): Make the old file not featured. (This is not possible yet
        # since there is no Google Code Data API yet.)
        import googlecode_upload
        name = self.distribution.get_name()
        version = self.distribution.get_version()

        # TODO(epg): sdist is more flexible with formats...
        fn = os.path.join(self.dist_dir, self.distribution.get_fullname())
        fn += '.tar.gz'
        if not os.path.isfile(fn):
            raise DistutilsError('missing source distribution file %s, '
                                 'run setup.py sdist' % fn)
        summary = ' '.join([name, version, 'source distribution'])
        labels = self.labels

        if self.user is None or self.password is None:
            svn_url, user = GetUrlAndUserFromSvn('.')
            if self.user is not None and user != self.user:
                raise DistutilsError('found svn user %r, got cmdline user %r' %
                                     (user, self.user))
            if self.password is None:
                password = GetSvnPassword(svn_url, user)
            else:
                password = self.password
        else:
            user = self.user
            password = self.password

        (status, reason,
         file_url) = googlecode_upload.upload_find_auth(file_path=fn,
                                                        project_name=name,
                                                        summary=summary,
                                                        labels=labels,
                                                        user_name=user,
                                                        password=password)
        if file_url is None:
            raise DistutilsError('upload error: %s (%d)\n' % (reason, status))

        sys.stdout.write('Uploaded %s\n' % (file_url, ))
Ejemplo n.º 13
0
    def run(self):
        width = 30
        print("-" * width)
        print("Building Kivy Portable for Win 32")
        print("-" * width)
        print("\nPreparing Build...")
        print("-" * width)
        if os.path.exists(self.build_dir):
            print("*Cleaning old build dir")
            shutil.rmtree(self.build_dir, ignore_errors=True)
        print("*Creating build directory:", self.build_dir)
        os.makedirs(self.build_dir)


        print("\nGetting binary dependencies...")
        print("---------------------------------------")
        print("*Downloading:", self.deps_url)
        #report_hook is called every time a piece of teh file is downloaded to print progress
        def report_hook(block_count, block_size, total_size):
            p = block_count * block_size * 100.0 / total_size
            print("\b\b\b\b\b\b\b\b\b", "%06.2f" % p + "%", end=' ')
        print(" Progress: 000.00%", end=' ')
        urlretrieve(self.deps_url, # location of binary dependencies needed for portable kivy
                    os.path.join(self.build_dir, 'deps.zip'), # tmp file to store the archive
                    reporthook = report_hook)
        print(" [Done]")


        print("*Extracting binary dependencies...")
        zf = ZipFile(os.path.join(self.build_dir, 'deps.zip'))
        zf.extractall(self.build_dir)
        zf.close()
        if self.no_mingw:
            print("*Excluding MinGW from portable distribution (--no-mingw option is set)")
            shutil.rmtree(os.path.join(self.build_dir, 'MinGW'), ignore_errors=True)


        print("\nPutting kivy into portable environment")
        print("---------------------------------------")
        print("*Building kivy source distribution")
        sdist_cmd = [sys.executable, #path to python.exe
                     os.path.join(self.src_dir, 'setup.py'), #path to setup.py
                     'sdist', #make setup.py create a src distribution
                     '--dist-dir=%s'%self.build_dir] #put it into build folder
        Popen(sdist_cmd, stdout=PIPE, stderr=PIPE).communicate()


        print("*Placing kivy source distribution in portable context")
        src_dist = os.path.join(self.build_dir, self.dist_name)
        zf = ZipFile(src_dist+'.zip')
        zf.extractall(self.build_dir)
        zf.close()
        if self.no_mingw or self.no_cext:
            print("*Skipping C Extension build (either --no_cext or --no_mingw option set)")
        else:
            print("*Compiling C Extensions inplace for portable distribution")
            cext_cmd = [sys.executable, #path to python.exe
                        'setup.py',
                        'build_ext', #make setup.py create a src distribution
                        '--inplace'] #do it inplace
            #this time it runs teh setup.py inside the source distribution
            #thats has been generated inside the build dir (to generate ext
            #for teh target, instead of the source were building from)
            Popen(cext_cmd, cwd=src_dist).communicate()


        print("\nFinalizing kivy portable distribution...")
        print("---------------------------------------")
        print("*Copying scripts and resources")
        #copy launcher script and readme to portable root dir/build dir
        kivy_bat = os.path.join(src_dist, 'kivy', 'tools', 'packaging', 'win32', 'kivy.bat')
        shutil.copy(kivy_bat, os.path.join(self.build_dir, 'kivy.bat'))
        kivyenv_sh = os.path.join(src_dist, 'kivy', 'tools', 'packaging', 'win32', 'kivyenv.sh')
        shutil.copy(kivyenv_sh, os.path.join(self.build_dir, 'kivyenv.sh'))
        readme = os.path.join(src_dist, 'kivy', 'tools', 'packaging', 'win32', 'README.txt')
        shutil.copy(readme, os.path.join(self.build_dir, 'README.txt'))
        #rename kivy directory to "kivy"
        os.rename(src_dist, os.path.join(self.build_dir, 'kivy'))

        print("*Removing intermediate file")
        os.remove(os.path.join(self.build_dir, 'deps.zip'))
        os.remove(os.path.join(self.build_dir, src_dist + '.zip'))

        print("*Compressing portable distribution target")
        target = os.path.join(self.dist_dir, self.dist_name + "-w32.zip")
        zip_directory(self.build_dir, target)
        print("*Writing target:", target)
        print("*Removing build dir")
        shutil.rmtree(self.build_dir, ignore_errors=True)

        print("*Upload to google code")
        sys.path += [os.path.join(self.src_dir, 'kivy', 'tools', 'packaging')]
        import googlecode_upload
        version = self.dist_name.replace("Kivy-", "")
        status, reason, url = googlecode_upload.upload_find_auth(
            target, 'kivy', 
            'Kivy {}, Windows portable version (Python 2.7, '
            '32 and 64 bits, bundled dependencies)'.format(version),
            ['Featured', 'OsSys-Windows'])

        if url:
              print('The file was uploaded successfully.')
              print('URL: %s' % url)
        else:
              print('An error occurred. Your file was not uploaded.')
              print('Google Code upload server said: %s (%s)' % (reason,
                  status))
Ejemplo n.º 14
0
def upload(path, labels, options):
  if options.dryrun:
    return
  summary = os.path.basename(path)
  status, reason, url = googlecode_upload.upload_find_auth(
      path, PROJECT, summary, labels, options.user, options.password)