Skip to content

Instantly share code, notes, and snippets.

@dcarley
Created August 21, 2012 10:37
Show Gist options
  • Save dcarley/3414366 to your computer and use it in GitHub Desktop.
Save dcarley/3414366 to your computer and use it in GitHub Desktop.
Upload Play modules to Artifactory Ivy repo
import re
import os
import pycurl
URL="http://xxx:8080/artifactory/play-release-local/xxx"
AUTH="play:xxx"
for local_file in os.listdir("."):
module, version = re.sub('\.(zip|dependencies\.yml)$', '', local_file).split("-", 1)
remote_file = re.sub('\.dependencies\.yml$', '-dependencies.yml', local_file)
c = pycurl.Curl()
c.setopt(pycurl.URL, "%s/%s/%s/%s" % (URL, module, version, remote_file))
c.setopt(pycurl.PUT, 1)
c.setopt(pycurl.USERPWD, AUTH)
c.setopt(pycurl.READFUNCTION, open(local_file, 'rb').read)
c.setopt(pycurl.INFILESIZE, os.path.getsize(local_file))
c.perform()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment