Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
{ pkgs, fetchFromGitHub, buildPythonPackage, pythonPackages }: | ||
|
||
buildPythonPackage rec { | ||
version = "2015-03-18"; | ||
name = "got-your-back-${version}"; | ||
|
||
src = fetchFromGitHub { | ||
owner = "jay0lee"; | ||
repo = "got-your-back"; | ||
rev = "3b087e78c330f43574ba388ffb03326280ac7d40"; | ||
sha256 = "1m45g7q6dg9m99nx6fr520iyviliafwdjq6ckczry8l4wjx49wwv"; | ||
}; | ||
|
||
doCheck = false; | ||
|
||
propagatedBuildInputs = with pythonPackages; [ | ||
sqlite3 | ||
]; | ||
|
||
patches = [ ./homedir.patch ]; | ||
|
||
postPatch = '' | ||
rm setup.py setup-64.py | ||
substituteInPlace gyb.py \ | ||
--replace "CLIENT_SECRETS = getProgPath()+" \ | ||
"CLIENT_SECRETS = \"$out/share/\"+" \ | ||
--replace "ca_certs=getProgPath()+" \ | ||
"ca_certs=\"$out/share/\"+" \ | ||
--replace "certFile = getProgPath()+" \ | ||
"certFile = \"$out/share/\"+" | ||
echo '#!/usr/bin/env python' > gyb | ||
tail -n +2 gyb.py >> gyb | ||
cat <<EOF > ./setup.py | ||
#!/usr/bin/env python | ||
from distutils.core import setup | ||
import glob | ||
setup(name='gyb', | ||
version='${version}', | ||
scripts=['gyb'], | ||
py_modules=[x[:-3] for x in glob.glob('*.py') if x != 'setup.py'], | ||
packages=['apiclient', 'httplib2', 'oauth2client', 'uritemplate'], | ||
data_files=[('share', ['client_secrets.json', 'cacert.pem'])] | ||
) | ||
EOF | ||
''; | ||
|
||
# `wrapPythonPrograms` inserts code before the module's docstring, which means | ||
# that python won't recognize it as a docstring anymore (i.e. `__doc__` will | ||
# be `None`). This breaks the `--help` command. | ||
# | ||
# Since the added code is not really needed, let's delete it. | ||
postPhases = [ "fixScript" ]; | ||
fixScript = '' | ||
sed -i "$out/bin/.gyb-wrapped" -e '{ | ||
/import sys; sys.argv/d | ||
}' | ||
''; | ||
|
||
meta = { | ||
description = "Command line tool for backing up your Gmail messages to your local computer"; | ||
longDescription = '' | ||
Got Your Back (GYB) is a command line tool for backing up your Gmail | ||
messages to your local computer. It uses the standard IMAP protocol but | ||
also takes advantage of some custom Gmail IMAP extensions. | ||
''; | ||
homepage = https://github.com/jay0lee/got-your-back; | ||
license = pkgs.lib.licenses.asl20; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
diff --git a/gyb.py b/gyb.py | ||
index e40f04f..4a7d509 100644 | ||
--- a/gyb.py | ||
+++ b/gyb.py | ||
@@ -150,11 +150,7 @@ def win32_unicode_argv(): | ||
return [argv[i] for i in xrange(start, argc.value)] | ||
|
||
def getProgPath(): | ||
- if os.path.abspath('/') != -1: | ||
- divider = '/' | ||
- else: | ||
- divider = '\\' | ||
- return os.path.dirname(os.path.realpath(sys.argv[0]))+divider | ||
+ return os.getenv("HOME") + "/.gyb/" | ||
|
||
def batch(iterable, size): | ||
sourceiter = iter(iterable) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters