Skip to content

Commit 8fe6a2d

Browse files
committed
nemo-dropbox: Re-add the install script and associated files to fix
non-interactive installation. They were removed when we were trying to get rid of python2 deps everywhere but without them downloading the daemon requires user interaction.
1 parent 74b9e77 commit 8fe6a2d

File tree

12 files changed

+2892
-6
lines changed

12 files changed

+2892
-6
lines changed

nemo-dropbox/Makefile.am

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,16 @@
1+
AUTOMAKE_OPTIONS = dist-bzip2 no-dist-gzip
2+
3+
bin_SCRIPTS = dropbox
4+
CLEANFILES = $(bin_SCRIPTS) dropbox.1 dropbox.txt
5+
EXTRA_DIST = dropbox.in build_dropbox.py dropbox.txt.in docgen.py rst2man.py
6+
man_MANS = dropbox.1
7+
8+
dropbox: dropbox.in build_dropbox.py
9+
python3 build_dropbox.py $(PACKAGE_VERSION) $(datadir)/applications < dropbox.in > dropbox
10+
chmod +x dropbox
11+
12+
dropbox.1: dropbox.txt.in dropbox docgen.py
13+
python3 docgen.py $(PACKAGE_VERSION) < dropbox.txt.in > dropbox.txt
14+
$(RST2MAN) dropbox.txt > dropbox.1
15+
116
SUBDIRS = data src

nemo-dropbox/build_dropbox.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import sys
2+
import gi
3+
gi.require_version('GdkPixbuf', '2.0')
4+
from gi.repository import GdkPixbuf
5+
6+
import re
7+
8+
def replace_many(src2dest, buf):
9+
src_re = re.compile('|'.join(re.escape(word) for word in src2dest))
10+
11+
def replace_repl(mo):
12+
return src2dest[mo.group()]
13+
return src_re.sub(replace_repl, buf)
14+
15+
if __name__ == '__main__':
16+
pixbuf64 = GdkPixbuf.Pixbuf.new_from_file("data/icons/hicolor/64x64/apps/dropbox.png")
17+
pixbuf16 = GdkPixbuf.Pixbuf.new_from_file("data/icons/hicolor/16x16/apps/dropbox.png")
18+
src2dest = {'@PACKAGE_VERSION@': sys.argv[1],
19+
'@DESKTOP_FILE_DIR@': sys.argv[2],
20+
'@IMAGEDATA64@': ("GdkPixbuf.Pixbuf.new_from_data(%r, GdkPixbuf.Colorspace.RGB, %r, %r, %r, %r, %r)" %
21+
(pixbuf64.get_pixels(), pixbuf64.get_has_alpha(), pixbuf64.get_bits_per_sample(),
22+
pixbuf64.get_width(), pixbuf64.get_height(), pixbuf64.get_rowstride())),
23+
'@IMAGEDATA16@': ("GdkPixbuf.Pixbuf.new_from_data(%r, GdkPixbuf.Colorspace.RGB, %r, %r, %r, %r, %r)" %
24+
(pixbuf16.get_pixels(), pixbuf16.get_has_alpha(), pixbuf16.get_bits_per_sample(),
25+
pixbuf16.get_width(), pixbuf16.get_height(), pixbuf16.get_rowstride())),
26+
}
27+
28+
buf = sys.stdin.read()
29+
sys.stdout.write(replace_many(src2dest, buf))

nemo-dropbox/configure.ac

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,35 @@ fi
2929
PKG_CHECK_MODULES(NEMO, libnemo-extension >= $NEMO_REQUIRED)
3030
PKG_CHECK_MODULES(GLIB, glib-2.0 >= $GLIB_REQUIRED)
3131

32+
AC_PATH_PROG([PYTHON3], [python3])
33+
34+
AC_PATH_PROG([RST2MAN], [rst2man], [python3 rst2man.py])
35+
AC_SUBST(RST2MAN)
36+
37+
# define module checking macro
38+
AC_DEFUN([PYTHON3_CHECK_MODULE], [
39+
AC_MSG_CHECKING([for $1 on python3])
40+
41+
cat <<EOF | python3
42+
try:
43+
import $2
44+
except:
45+
exit(1)
46+
else:
47+
exit(0)
48+
EOF
49+
50+
if test $? -ne 0; then
51+
AC_MSG_RESULT([no])
52+
AC_MSG_ERROR([couldn't find $1])
53+
else
54+
AC_MSG_RESULT([yes])
55+
fi
56+
])
57+
58+
PYTHON3_CHECK_MODULE(docutils, docutils)
59+
PYTHON3_CHECK_MODULE(gi, gi)
60+
3261
# Make dependency CFLAGS and LIBS available
3362
AC_SUBST(NEMO_CFLAGS)
3463
AC_SUBST(NEMO_LIBS)

nemo-dropbox/data/Makefile.am

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1+
applicationdir = $(datadir)/applications
2+
application_DATA = dropbox.desktop
3+
4+
EXTRA_DIST = $(application_DATA)
5+
16
SUBDIRS = icons emblems

nemo-dropbox/data/dropbox.desktop

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[Desktop Entry]
2+
Name=Dropbox
3+
GenericName=File Synchronizer
4+
Comment=Sync your files across computers and to the web
5+
Exec=dropbox start -i
6+
Terminal=false
7+
Type=Application
8+
Icon=dropbox
9+
Categories=Network;FileTransfer;
10+
Keywords=file;synchronization;sharing;collaboration;cloud;storage;backup;
11+
StartupNotify=false

nemo-dropbox/debian/compat

Lines changed: 0 additions & 1 deletion
This file was deleted.

nemo-dropbox/debian/control

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@ Source: nemo-dropbox
22
Section: non-free/gnome
33
Priority: optional
44
Maintainer: Clement Lefebvre <[email protected]>
5-
Build-Depends: debhelper (>= 9),
5+
Build-Depends: debhelper-compat (= 11),
6+
dh-python,
67
libnemo-extension-dev (>= 1.0.0),
78
libglib2.0-dev (>= 2.14.0),
8-
dh-autoreconf,
9+
python3-all,
10+
python3-docutils,
11+
python3-gi
912
Standards-Version: 3.9.6
1013
XS-Autobuild: yes
1114
Homepage: http://www.dropbox.com/
@@ -15,9 +18,9 @@ Architecture: i386 amd64
1518
Depends: nemo,
1619
policykit-1,
1720
procps,
21+
python3-gi,
1822
${shlibs:Depends},
19-
${misc:Depends},
20-
dropbox
23+
${misc:Depends}
2124
Description: Dropbox integration for Nemo
2225
Nemo Dropbox is an extension that integrates the Dropbox web service with
2326
your Cinnamon Desktop.

nemo-dropbox/debian/rules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/make -f
22

33
%:
4-
dh $@ --with=autoreconf
4+
dh $@ --with=python3
55

66
override_dh_autoreconf:
77
dh_autoreconf --as-needed

nemo-dropbox/docgen.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import os
2+
import sys
3+
import time
4+
import datetime
5+
6+
# heeeheee
7+
env = {"__name__":"__notmain__"}
8+
exec(open("dropbox").read(), env)
9+
commands = env["commands"]
10+
11+
f = open("AUTHORS", "r")
12+
authors = '| ' + f.read().replace('\n', '\n| ')
13+
f.close()
14+
15+
formatted_commands = ""
16+
for cmd in commands:
17+
split = commands[cmd].__doc__.split('\n', 2)
18+
formatted_commands += split[1].replace(cmd, "`%s`" % cmd).replace("dropbox", "``dropbox``")
19+
formatted_commands += split[2].replace('\n', '\n | ')
20+
formatted_commands += '\n\n'
21+
22+
date = datetime.datetime.utcfromtimestamp(int(os.environ.get('SOURCE_DATE_EPOCH', time.time()))).date()
23+
sys.stdout.write(sys.stdin.read().replace\
24+
('@AUTHORS@', authors).replace\
25+
('@DATE@', date.isoformat()).replace\
26+
('@PACKAGE_VERSION@', sys.argv[1]).replace\
27+
('@SYNOPSIS@', '| '+'\n| '.join(commands[cmd].__doc__.split('\n', 2)[1].replace(cmd, "`%s`" % cmd).replace("dropbox", "``dropbox``") for cmd in commands)).replace\
28+
('@COMMANDS@', formatted_commands))

0 commit comments

Comments
 (0)