rsync wrapper for pushing incremental backups
Révision | f9cac849ec816677e8beb35afe50a585b97a5786 (tree) |
---|---|
l'heure | 2019-11-15 17:40:01 |
Auteur | Frank Tobin <ftobin@neve...> |
Commiter | Frank Tobin |
packaging fixes
@@ -1,27 +1,44 @@ | ||
1 | 1 | #!/usr/bin/python3 |
2 | 2 | |
3 | +import os | |
3 | 4 | import setuptools |
4 | 5 | import subprocess |
5 | 6 | import setuptools.command.sdist |
7 | +import setuptools.command.install | |
6 | 8 | from distutils import log |
7 | 9 | |
8 | 10 | with open("README.md", "r") as fh: |
9 | 11 | long_description = fh.read() |
10 | 12 | |
11 | 13 | |
14 | +manpage = 'rsnappush.1' | |
15 | + | |
16 | +def run(cmd): | |
17 | + log.info("calling " + ' '.join(cmd)) | |
18 | + subprocess.run(cmd, check=True) | |
19 | + | |
20 | + | |
12 | 21 | class my_sdist(setuptools.command.sdist.sdist): |
13 | 22 | def run(self): |
14 | 23 | cmd = ["ronn", "--roff", "README.md"] |
15 | - log.info("calling " + ' '.join(cmd)) | |
16 | - subprocess.run(cmd, check=True) | |
24 | + run(cmd) | |
17 | 25 | |
18 | 26 | cmd = ["mv", "README.1", "rsnappush.1"] |
19 | - log.info("calling " + ' '.join(cmd)) | |
20 | - subprocess.run(cmd, check=True) | |
27 | + run(cmd) | |
21 | 28 | |
22 | 29 | super().run() |
23 | 30 | |
24 | 31 | |
32 | +class my_install(setuptools.command.install.install): | |
33 | + def run(self): | |
34 | + os.umask(0o002) | |
35 | + run(['chmod', '-R', 'a+rX', 'rsnappush.egg-info']) | |
36 | + | |
37 | + stat = os.stat(manpage) | |
38 | + os.chmod(manpage, stat.st_mode | 0o444) | |
39 | + super().run() | |
40 | + | |
41 | + | |
25 | 42 | setuptools.setup(name='rsnappush', |
26 | 43 | version = '1.1', |
27 | 44 | packages = setuptools.find_packages(), |
@@ -33,6 +50,8 @@ | ||
33 | 50 | long_description = long_description, |
34 | 51 | platforms = "POSIX", |
35 | 52 | scripts=["rsnappush"], |
36 | - data_files=[('share/man/man1/', ['rsnappush.1'])], | |
37 | - cmdclass = {'sdist': my_sdist}, | |
53 | + data_files=[('share/man/man1/', [manpage])], | |
54 | + cmdclass = {'sdist': my_sdist, | |
55 | + 'install': my_install, | |
56 | + }, | |
38 | 57 | ) |