989
by Kenneth Loafman
* Update shebang line to python2 instead of python to avoid confusion. |
1 |
#!/usr/bin/env python2
|
335
by loafman
patch #6675: Add modelines |
2 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
|
404
by loafman
Add/update copyright statements in all distribution source files |
3 |
#
|
4 |
# Copyright 2002 Ben Escoto <ben@emerose.org>
|
|
5 |
# Copyright 2007 Kenneth Loafman <kenneth@loafman.com>
|
|
6 |
#
|
|
7 |
# This file is part of duplicity.
|
|
8 |
#
|
|
9 |
# Duplicity is free software; you can redistribute it and/or modify it
|
|
10 |
# under the terms of the GNU General Public License as published by the
|
|
476
by loafman
After email voting among known duplicity contributors, |
11 |
# Free Software Foundation; either version 2 of the License, or (at your
|
404
by loafman
Add/update copyright statements in all distribution source files |
12 |
# option) any later version.
|
13 |
#
|
|
14 |
# Duplicity is distributed in the hope that it will be useful, but
|
|
15 |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
17 |
# General Public License for more details.
|
|
18 |
#
|
|
19 |
# You should have received a copy of the GNU General Public License
|
|
20 |
# along with duplicity; if not, write to the Free Software Foundation,
|
|
21 |
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
1
by bescoto
Initial checkin |
22 |
|
1071
by Kenneth Loafman
* Misc fixes for the following PEP8 issues: |
23 |
import sys |
24 |
import os |
|
967.2.2
by Michael Terry
Enable/use more mordern testing tools like nosetest and tox as well as more common setup.py hooks like test and sdist |
25 |
from setuptools import setup, Extension |
26 |
from setuptools.command.test import test |
|
27 |
from setuptools.command.install import install |
|
28 |
from setuptools.command.sdist import sdist |
|
1135.1.1
by ede
don't touch my shebang |
29 |
from distutils.command.build_scripts import build_scripts |
1
by bescoto
Initial checkin |
30 |
|
365
by loafman
Change "test" to "$version". |
31 |
version_string = "$version" |
1
by bescoto
Initial checkin |
32 |
|
1305
by ken
* Patched in lp:~mterry/duplicity/giobackend-display-name |
33 |
if sys.version_info[:2] < (2, 6) or sys.version_info[:2] > (2, 7): |
34 |
print("Sorry, duplicity requires version 2.6 or 2.7 of python.") |
|
304
by loafman
Untabify all files. To compare against previous |
35 |
sys.exit(1) |
1
by bescoto
Initial checkin |
36 |
|
363
by loafman
bug #25194: Duplicity 5.04 requires python-distutils-extra... |
37 |
incdir_list = libdir_list = None |
164
by loafman
https://savannah.nongnu.org/patch/index.php?6205 |
38 |
|
39 |
if os.name == 'posix': |
|
304
by loafman
Untabify all files. To compare against previous |
40 |
LIBRSYNC_DIR = os.environ.get('LIBRSYNC_DIR', '') |
41 |
args = sys.argv[:] |
|
42 |
for arg in args: |
|
43 |
if arg.startswith('--librsync-dir='): |
|
44 |
LIBRSYNC_DIR = arg.split('=')[1] |
|
45 |
sys.argv.remove(arg) |
|
46 |
if LIBRSYNC_DIR: |
|
47 |
incdir_list = [os.path.join(LIBRSYNC_DIR, 'include')] |
|
48 |
libdir_list = [os.path.join(LIBRSYNC_DIR, 'lib')] |
|
139
by loafman
- Print warning if pexpect version is less than 2.1. |
49 |
|
364
by loafman
Build list of .mo files to be installed from po directory. |
50 |
data_files = [('share/man/man1', |
800.1.24
by Michael Terry
Make tarball layout match bzr layout much more closely; ship tests in tarballs and adjust things so that they can work |
51 |
['bin/duplicity.1', |
52 |
'bin/rdiffdir.1']), |
|
364
by loafman
Build list of .mo files to be installed from po directory. |
53 |
('share/doc/duplicity-%s' % version_string, |
54 |
['COPYING', |
|
55 |
'README', |
|
814
by Kenneth Loafman
- Make adjustments for the new structure. |
56 |
'README-REPO', |
57 |
'README-LOG', |
|
364
by loafman
Build list of .mo files to be installed from po directory. |
58 |
'CHANGELOG']), |
59 |
]
|
|
60 |
||
967.2.2
by Michael Terry
Enable/use more mordern testing tools like nosetest and tox as well as more common setup.py hooks like test and sdist |
61 |
top_dir = os.path.dirname(os.path.abspath(__file__)) |
62 |
assert os.path.exists(os.path.join(top_dir, "po")), "Missing 'po' directory." |
|
63 |
for root, dirs, files in os.walk(os.path.join(top_dir, "po")): |
|
364
by loafman
Build list of .mo files to be installed from po directory. |
64 |
for file in files: |
65 |
path = os.path.join(root, file) |
|
66 |
if path.endswith("duplicity.mo"): |
|
67 |
lang = os.path.split(root)[-1] |
|
68 |
data_files.append( |
|
69 |
('share/locale/%s/LC_MESSAGES' % lang, |
|
70 |
["po/%s/duplicity.mo" % lang])) |
|
71 |
||
967.2.2
by Michael Terry
Enable/use more mordern testing tools like nosetest and tox as well as more common setup.py hooks like test and sdist |
72 |
|
73 |
class TestCommand(test): |
|
1144
by Kenneth Loafman
Try adding spaces. |
74 |
|
967.2.2
by Michael Terry
Enable/use more mordern testing tools like nosetest and tox as well as more common setup.py hooks like test and sdist |
75 |
def run(self): |
76 |
# Make sure all modules are ready
|
|
77 |
build_cmd = self.get_finalized_command("build_py") |
|
78 |
build_cmd.run() |
|
79 |
# And make sure our scripts are ready
|
|
80 |
build_scripts_cmd = self.get_finalized_command("build_scripts") |
|
81 |
build_scripts_cmd.run() |
|
82 |
||
83 |
# make symlinks for test data
|
|
84 |
if build_cmd.build_lib != top_dir: |
|
977.1.7
by Michael Terry
more minor fixes |
85 |
for path in ['testfiles.tar.gz', 'gnupg']: |
967.2.2
by Michael Terry
Enable/use more mordern testing tools like nosetest and tox as well as more common setup.py hooks like test and sdist |
86 |
src = os.path.join(top_dir, 'testing', path) |
87 |
target = os.path.join(build_cmd.build_lib, 'testing', path) |
|
88 |
try: |
|
89 |
os.symlink(src, target) |
|
90 |
except Exception: |
|
91 |
pass
|
|
92 |
||
93 |
os.environ['PATH'] = "%s:%s" % ( |
|
94 |
os.path.abspath(build_scripts_cmd.build_dir), |
|
95 |
os.environ.get('PATH')) |
|
96 |
||
97 |
test.run(self) |
|
98 |
||
99 |
||
100 |
class InstallCommand(install): |
|
1144
by Kenneth Loafman
Try adding spaces. |
101 |
|
967.2.2
by Michael Terry
Enable/use more mordern testing tools like nosetest and tox as well as more common setup.py hooks like test and sdist |
102 |
def run(self): |
103 |
# Normally, install will call build(). But we want to delete the
|
|
104 |
# testing dir between building and installing. So we manually build
|
|
105 |
# and mark ourselves to skip building when we run() for real.
|
|
106 |
self.run_command('build') |
|
107 |
self.skip_build = True |
|
108 |
||
109 |
# This should always be true, but just to make sure!
|
|
110 |
if self.build_lib != top_dir: |
|
111 |
testing_dir = os.path.join(self.build_lib, 'testing') |
|
112 |
os.system("rm -rf %s" % testing_dir) |
|
113 |
||
114 |
install.run(self) |
|
115 |
||
116 |
||
117 |
# TODO: move logic from dist/makedist inline
|
|
118 |
class SDistCommand(sdist): |
|
1144
by Kenneth Loafman
Try adding spaces. |
119 |
|
967.2.2
by Michael Terry
Enable/use more mordern testing tools like nosetest and tox as well as more common setup.py hooks like test and sdist |
120 |
def run(self): |
121 |
version = version_string |
|
122 |
if version[0] == '$': |
|
1196
by Kenneth Loafman
* More fixes to dist/makedist to make it more OS agnostic. |
123 |
version = "0.0dev" |
967.2.2
by Michael Terry
Enable/use more mordern testing tools like nosetest and tox as well as more common setup.py hooks like test and sdist |
124 |
os.system(os.path.join(top_dir, "dist", "makedist") + " " + version) |
967.2.3
by Michael Terry
Whoops, make dist dir first during sdist |
125 |
os.system("mkdir -p " + self.dist_dir) |
967.2.2
by Michael Terry
Enable/use more mordern testing tools like nosetest and tox as well as more common setup.py hooks like test and sdist |
126 |
os.system("mv duplicity-" + version + ".tar.gz " + self.dist_dir) |
127 |
||
1139
by Kenneth Loafman
* Cleanup issues around Launchpad build, mainly lockfile >= 0.9. |
128 |
|
1135.1.1
by ede
don't touch my shebang |
129 |
# don't touch my shebang
|
130 |
class BSCommand (build_scripts): |
|
1144
by Kenneth Loafman
Try adding spaces. |
131 |
|
1135.1.1
by ede
don't touch my shebang |
132 |
def run(self): |
133 |
"""
|
|
134 |
Copy, chmod each script listed in 'self.scripts'
|
|
1196
by Kenneth Loafman
* More fixes to dist/makedist to make it more OS agnostic. |
135 |
essentially this is the stripped
|
1135.1.1
by ede
don't touch my shebang |
136 |
distutils.command.build_scripts.copy_scripts()
|
137 |
routine
|
|
138 |
"""
|
|
139 |
from stat import ST_MODE |
|
140 |
from distutils.dep_util import newer |
|
141 |
from distutils import log |
|
142 |
||
143 |
self.mkpath(self.build_dir) |
|
144 |
outfiles = [] |
|
145 |
for script in self.scripts: |
|
146 |
outfile = os.path.join(self.build_dir, os.path.basename(script)) |
|
147 |
outfiles.append(outfile) |
|
148 |
||
149 |
if not self.force and not newer(script, outfile): |
|
150 |
log.debug("not copying %s (up-to-date)", script) |
|
151 |
continue
|
|
152 |
||
153 |
log.info("copying and NOT adjusting %s -> %s", script, |
|
1144
by Kenneth Loafman
Try adding spaces. |
154 |
self.build_dir) |
1135.1.1
by ede
don't touch my shebang |
155 |
self.copy_file(script, outfile) |
156 |
||
157 |
if os.name == 'posix': |
|
158 |
for file in outfiles: |
|
159 |
if self.dry_run: |
|
160 |
log.info("changing mode of %s", file) |
|
161 |
else: |
|
162 |
oldmode = os.stat(file)[ST_MODE] & 0o7777 |
|
163 |
newmode = (oldmode | 0o555) & 0o7777 |
|
164 |
if newmode != oldmode: |
|
165 |
log.info("changing mode of %s from %o to %o", |
|
166 |
file, oldmode, newmode) |
|
167 |
os.chmod(file, newmode) |
|
967.2.2
by Michael Terry
Enable/use more mordern testing tools like nosetest and tox as well as more common setup.py hooks like test and sdist |
168 |
|
1139
by Kenneth Loafman
* Cleanup issues around Launchpad build, mainly lockfile >= 0.9. |
169 |
|
1
by bescoto
Initial checkin |
170 |
setup(name="duplicity", |
304
by loafman
Untabify all files. To compare against previous |
171 |
version=version_string, |
172 |
description="Encrypted backup using rsync algorithm", |
|
404
by loafman
Add/update copyright statements in all distribution source files |
173 |
author="Ben Escoto <ben@emerose.org>", |
304
by loafman
Untabify all files. To compare against previous |
174 |
author_email="bescoto@stanford.edu", |
404
by loafman
Add/update copyright statements in all distribution source files |
175 |
maintainer="Kenneth Loafman <kenneth@loafman.com>", |
304
by loafman
Untabify all files. To compare against previous |
176 |
maintainer_email="kenneth@loafman.com", |
177 |
url="http://duplicity.nongnu.org/index.html", |
|
1033
by Kenneth Loafman
* Source formatted, using PyDev, all source files to fix some easily fixed |
178 |
packages=['duplicity', |
1139
by Kenneth Loafman
* Cleanup issues around Launchpad build, mainly lockfile >= 0.9. |
179 |
'duplicity.backends', |
180 |
'duplicity.backends.pyrax_identity', |
|
181 |
'testing', |
|
182 |
'testing.functional', |
|
183 |
'testing.overrides', |
|
184 |
'testing.unit'], |
|
1061
by Kenneth Loafman
* Misc fixes for the following PEP8 issues: |
185 |
package_dir={"duplicity": "duplicity", |
186 |
"duplicity.backends": "duplicity/backends", }, |
|
1305
by ken
* Patched in lp:~mterry/duplicity/giobackend-display-name |
187 |
ext_modules=[Extension("duplicity._librsync", |
188 |
["duplicity/_librsyncmodule.c"], |
|
189 |
include_dirs=incdir_list, |
|
190 |
library_dirs=libdir_list, |
|
191 |
libraries=["rsync"])], |
|
1033
by Kenneth Loafman
* Source formatted, using PyDev, all source files to fix some easily fixed |
192 |
scripts=['bin/rdiffdir', 'bin/duplicity'], |
193 |
data_files=data_files, |
|
1283
by Kenneth Loafman
* Fixed bug #1320641 and others regarding lockfile |
194 |
install_requires=['fasteners'], |
195 |
tests_require=['fasteners', 'mock', 'pexpect'], |
|
1033
by Kenneth Loafman
* Source formatted, using PyDev, all source files to fix some easily fixed |
196 |
test_suite='testing', |
967.2.2
by Michael Terry
Enable/use more mordern testing tools like nosetest and tox as well as more common setup.py hooks like test and sdist |
197 |
cmdclass={'test': TestCommand, |
198 |
'install': InstallCommand, |
|
1135.1.1
by ede
don't touch my shebang |
199 |
'sdist': SDistCommand, |
200 |
'build_scripts': BSCommand}, |
|
364
by loafman
Build list of .mo files to be installed from po directory. |
201 |
)
|