Uploader Implementation

Uploader implementation. The code in here surrounds the uploaders’ implementations, and properly invokes the uploader with correct arguments, etc.

class dput.uploader.AbstractUploader(profile)

Abstract base class for all concrete uploader implementations.

abstract initialize(**kwargs)

Setup the things needed to upload a file. Usually this means creating a network connection & authenticating.

abstract shutdown()

Disconnect and shutdown.

abstract upload_file(filename, upload_filename=None)

Upload a single file (filename) to the server.

upload_write_error(e)

Warning

don’t call this.

please don’t call this

class dput.uploader.DputNamespace
dput.uploader.determine_logfile(changes, conf, args)

Figure out what logfile to write to. This is mostly an internal implementation. Returns the file to log to, given a changes and profile.

dput.uploader.invoke_dput(changes, args)

Warning

This method may change names. Please use it via dput.upload(). also, please don’t depend on args, that’s likely to change shortly.

Given a changes file changes, and arguments to dput args, upload a package to the archive that makes sense.

dput.uploader.uploader(uploader_method, profile, simulate=True)

Context-managed uploader implementation.

Invoke sorta like:

with uploader() as obj:
    obj.upload_file('filename')

This will automatically call that object’s dput.uploader.AbstractUploader.initialize(), pre-hook, yield the object, call the post hook and invoke it’s dput.uploader.AbstractUploader.shutdown().