setup.py 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647
  1. # -*- encoding: utf-8 *-*
  2. import os
  3. import io
  4. import re
  5. import sys
  6. from collections import OrderedDict
  7. from datetime import datetime
  8. from glob import glob
  9. from distutils.command.build import build
  10. from distutils.core import Command
  11. import textwrap
  12. min_python = (3, 4)
  13. my_python = sys.version_info
  14. if my_python < min_python:
  15. print("Borg requires Python %d.%d or later" % min_python)
  16. sys.exit(1)
  17. # Are we building on ReadTheDocs?
  18. on_rtd = os.environ.get('READTHEDOCS')
  19. # msgpack pure python data corruption was fixed in 0.4.6.
  20. # Also, we might use some rather recent API features.
  21. install_requires = ['msgpack-python>=0.4.6', ]
  22. # note for package maintainers: if you package borgbackup for distribution,
  23. # please add llfuse as a *requirement* on all platforms that have a working
  24. # llfuse package. "borg mount" needs llfuse to work.
  25. # if you do not have llfuse, do not require it, most of borgbackup will work.
  26. extras_require = {
  27. # llfuse 0.40 (tested, proven, ok), needs FUSE version >= 2.8.0
  28. # llfuse 0.41 (tested shortly, looks ok), needs FUSE version >= 2.8.0
  29. # llfuse 0.41.1 (tested shortly, looks ok), needs FUSE version >= 2.8.0
  30. # llfuse 0.42 (tested shortly, looks ok), needs FUSE version >= 2.8.0
  31. # llfuse 1.0 (tested shortly, looks ok), needs FUSE version >= 2.8.0
  32. # llfuse 1.1.1 (tested shortly, looks ok), needs FUSE version >= 2.8.0
  33. # llfuse 2.0 will break API
  34. 'fuse': ['llfuse<2.0', ],
  35. }
  36. if sys.platform.startswith('freebsd'):
  37. # llfuse was frequently broken / did not build on freebsd
  38. # llfuse 0.41.1, 1.1 are ok
  39. extras_require['fuse'] = ['llfuse <2.0, !=0.42.*, !=0.43, !=1.0', ]
  40. from setuptools import setup, find_packages, Extension
  41. from setuptools.command.sdist import sdist
  42. compress_source = 'src/borg/compress.pyx'
  43. crypto_source = 'src/borg/crypto.pyx'
  44. chunker_source = 'src/borg/chunker.pyx'
  45. hashindex_source = 'src/borg/hashindex.pyx'
  46. item_source = 'src/borg/item.pyx'
  47. crc32_source = 'src/borg/crc32.pyx'
  48. platform_posix_source = 'src/borg/platform/posix.pyx'
  49. platform_linux_source = 'src/borg/platform/linux.pyx'
  50. platform_darwin_source = 'src/borg/platform/darwin.pyx'
  51. platform_freebsd_source = 'src/borg/platform/freebsd.pyx'
  52. cython_sources = [
  53. compress_source,
  54. crypto_source,
  55. chunker_source,
  56. hashindex_source,
  57. item_source,
  58. crc32_source,
  59. platform_posix_source,
  60. platform_linux_source,
  61. platform_freebsd_source,
  62. platform_darwin_source,
  63. ]
  64. try:
  65. from Cython.Distutils import build_ext
  66. import Cython.Compiler.Main as cython_compiler
  67. class Sdist(sdist):
  68. def __init__(self, *args, **kwargs):
  69. for src in cython_sources:
  70. cython_compiler.compile(src, cython_compiler.default_options)
  71. super().__init__(*args, **kwargs)
  72. def make_distribution(self):
  73. self.filelist.extend([
  74. 'src/borg/compress.c',
  75. 'src/borg/crypto.c',
  76. 'src/borg/chunker.c', 'src/borg/_chunker.c',
  77. 'src/borg/hashindex.c', 'src/borg/_hashindex.c',
  78. 'src/borg/item.c',
  79. 'src/borg/crc32.c',
  80. 'src/borg/_crc32/crc32.c', 'src/borg/_crc32/clmul.c', 'src/borg/_crc32/slice_by_8.c',
  81. 'src/borg/platform/posix.c',
  82. 'src/borg/platform/linux.c',
  83. 'src/borg/platform/freebsd.c',
  84. 'src/borg/platform/darwin.c',
  85. ])
  86. super().make_distribution()
  87. except ImportError:
  88. class Sdist(sdist):
  89. def __init__(self, *args, **kwargs):
  90. raise Exception('Cython is required to run sdist')
  91. compress_source = compress_source.replace('.pyx', '.c')
  92. crypto_source = crypto_source.replace('.pyx', '.c')
  93. chunker_source = chunker_source.replace('.pyx', '.c')
  94. hashindex_source = hashindex_source.replace('.pyx', '.c')
  95. item_source = item_source.replace('.pyx', '.c')
  96. crc32_source = crc32_source.replace('.pyx', '.c')
  97. platform_posix_source = platform_posix_source.replace('.pyx', '.c')
  98. platform_linux_source = platform_linux_source.replace('.pyx', '.c')
  99. platform_freebsd_source = platform_freebsd_source.replace('.pyx', '.c')
  100. platform_darwin_source = platform_darwin_source.replace('.pyx', '.c')
  101. from distutils.command.build_ext import build_ext
  102. if not on_rtd and not all(os.path.exists(path) for path in [
  103. compress_source, crypto_source, chunker_source, hashindex_source, item_source, crc32_source,
  104. platform_posix_source, platform_linux_source, platform_freebsd_source, platform_darwin_source]):
  105. raise ImportError('The GIT version of Borg needs Cython. Install Cython or use a released version.')
  106. def detect_openssl(prefixes):
  107. for prefix in prefixes:
  108. filename = os.path.join(prefix, 'include', 'openssl', 'evp.h')
  109. if os.path.exists(filename):
  110. with open(filename, 'r') as fd:
  111. if 'PKCS5_PBKDF2_HMAC(' in fd.read():
  112. return prefix
  113. def detect_lz4(prefixes):
  114. for prefix in prefixes:
  115. filename = os.path.join(prefix, 'include', 'lz4.h')
  116. if os.path.exists(filename):
  117. with open(filename, 'r') as fd:
  118. if 'LZ4_decompress_safe' in fd.read():
  119. return prefix
  120. def detect_libb2(prefixes):
  121. for prefix in prefixes:
  122. filename = os.path.join(prefix, 'include', 'blake2.h')
  123. if os.path.exists(filename):
  124. with open(filename, 'r') as fd:
  125. if 'blake2b_init' in fd.read():
  126. return prefix
  127. include_dirs = []
  128. library_dirs = []
  129. define_macros = []
  130. crypto_libraries = ['crypto']
  131. possible_openssl_prefixes = ['/usr', '/usr/local', '/usr/local/opt/openssl', '/usr/local/ssl', '/usr/local/openssl',
  132. '/usr/local/borg', '/opt/local', '/opt/pkg', ]
  133. if os.environ.get('BORG_OPENSSL_PREFIX'):
  134. possible_openssl_prefixes.insert(0, os.environ.get('BORG_OPENSSL_PREFIX'))
  135. ssl_prefix = detect_openssl(possible_openssl_prefixes)
  136. if not ssl_prefix:
  137. raise Exception('Unable to find OpenSSL >= 1.0 headers. (Looked here: {})'.format(', '.join(possible_openssl_prefixes)))
  138. include_dirs.append(os.path.join(ssl_prefix, 'include'))
  139. library_dirs.append(os.path.join(ssl_prefix, 'lib'))
  140. possible_lz4_prefixes = ['/usr', '/usr/local', '/usr/local/opt/lz4', '/usr/local/lz4',
  141. '/usr/local/borg', '/opt/local', '/opt/pkg', ]
  142. if os.environ.get('BORG_LZ4_PREFIX'):
  143. possible_lz4_prefixes.insert(0, os.environ.get('BORG_LZ4_PREFIX'))
  144. lz4_prefix = detect_lz4(possible_lz4_prefixes)
  145. if lz4_prefix:
  146. include_dirs.append(os.path.join(lz4_prefix, 'include'))
  147. library_dirs.append(os.path.join(lz4_prefix, 'lib'))
  148. elif not on_rtd:
  149. raise Exception('Unable to find LZ4 headers. (Looked here: {})'.format(', '.join(possible_lz4_prefixes)))
  150. possible_libb2_prefixes = ['/usr', '/usr/local', '/usr/local/opt/libb2', '/usr/local/libb2',
  151. '/usr/local/borg', '/opt/local', '/opt/pkg', ]
  152. if os.environ.get('BORG_LIBB2_PREFIX'):
  153. possible_libb2_prefixes.insert(0, os.environ.get('BORG_LIBB2_PREFIX'))
  154. libb2_prefix = detect_libb2(possible_libb2_prefixes)
  155. if libb2_prefix:
  156. print('Detected and preferring libb2 over bundled BLAKE2')
  157. include_dirs.append(os.path.join(libb2_prefix, 'include'))
  158. library_dirs.append(os.path.join(libb2_prefix, 'lib'))
  159. crypto_libraries.append('b2')
  160. define_macros.append(('BORG_USE_LIBB2', 'YES'))
  161. with open('README.rst', 'r') as fd:
  162. long_description = fd.read()
  163. # remove badges
  164. long_description = re.compile(r'^\.\. start-badges.*^\.\. end-badges', re.M | re.S).sub('', long_description)
  165. # remove |substitutions|
  166. long_description = re.compile(r'\|screencast\|').sub('', long_description)
  167. # remove unknown directives
  168. long_description = re.compile(r'^\.\. highlight:: \w+$', re.M).sub('', long_description)
  169. class build_usage(Command):
  170. description = "generate usage for each command"
  171. user_options = [
  172. ('output=', 'O', 'output directory'),
  173. ]
  174. def initialize_options(self):
  175. pass
  176. def finalize_options(self):
  177. pass
  178. def run(self):
  179. print('generating usage docs')
  180. if not os.path.exists('docs/usage'):
  181. os.mkdir('docs/usage')
  182. # allows us to build docs without the C modules fully loaded during help generation
  183. from borg.archiver import Archiver
  184. parser = Archiver(prog='borg').parser
  185. self.generate_level("", parser, Archiver)
  186. def generate_level(self, prefix, parser, Archiver):
  187. is_subcommand = False
  188. choices = {}
  189. for action in parser._actions:
  190. if action.choices is not None and 'SubParsersAction' in str(action.__class__):
  191. is_subcommand = True
  192. for cmd, parser in action.choices.items():
  193. choices[prefix + cmd] = parser
  194. if prefix and not choices:
  195. return
  196. print('found commands: %s' % list(choices.keys()))
  197. for command, parser in sorted(choices.items()):
  198. if command.startswith('debug'):
  199. print('skipping', command)
  200. continue
  201. print('generating help for %s' % command)
  202. if self.generate_level(command + " ", parser, Archiver):
  203. continue
  204. with open('docs/usage/%s.rst.inc' % command.replace(" ", "_"), 'w') as doc:
  205. doc.write(".. IMPORTANT: this file is auto-generated from borg's built-in help, do not edit!\n\n")
  206. if command == 'help':
  207. for topic in Archiver.helptext:
  208. params = {"topic": topic,
  209. "underline": '~' * len('borg help ' + topic)}
  210. doc.write(".. _borg_{topic}:\n\n".format(**params))
  211. doc.write("borg help {topic}\n{underline}\n\n".format(**params))
  212. doc.write(Archiver.helptext[topic])
  213. else:
  214. params = {"command": command,
  215. "command_": command.replace(' ', '_'),
  216. "underline": '-' * len('borg ' + command)}
  217. doc.write(".. _borg_{command_}:\n\n".format(**params))
  218. doc.write("borg {command}\n{underline}\n::\n\n borg {command}".format(**params))
  219. self.write_usage(parser, doc)
  220. epilog = parser.epilog
  221. parser.epilog = None
  222. self.write_options(parser, doc)
  223. doc.write("\n\nDescription\n~~~~~~~~~~~\n")
  224. doc.write(epilog)
  225. if 'create' in choices:
  226. common_options = [group for group in choices['create']._action_groups if group.title == 'Common options'][0]
  227. with open('docs/usage/common-options.rst.inc', 'w') as doc:
  228. self.write_options_group(common_options, doc, False)
  229. return is_subcommand
  230. def write_usage(self, parser, fp):
  231. if any(len(o.option_strings) for o in parser._actions):
  232. fp.write(' <options>')
  233. for option in parser._actions:
  234. if option.option_strings:
  235. continue
  236. fp.write(' ' + option.metavar)
  237. def write_options(self, parser, fp):
  238. for group in parser._action_groups:
  239. if group.title == 'Common options':
  240. fp.write('\n\n`Common options`_\n')
  241. fp.write(' |')
  242. else:
  243. self.write_options_group(group, fp)
  244. def write_options_group(self, group, fp, with_title=True):
  245. def is_positional_group(group):
  246. return any(not o.option_strings for o in group._group_actions)
  247. def get_help(option):
  248. text = textwrap.dedent((option.help or '') % option.__dict__)
  249. return '\n'.join('| ' + line for line in text.splitlines())
  250. def shipout(text):
  251. fp.write(textwrap.indent('\n'.join(text), ' ' * 4))
  252. if not group._group_actions:
  253. return
  254. if with_title:
  255. fp.write('\n\n')
  256. fp.write(group.title + '\n')
  257. text = []
  258. if is_positional_group(group):
  259. for option in group._group_actions:
  260. text.append(option.metavar)
  261. text.append(textwrap.indent(option.help or '', ' ' * 4))
  262. shipout(text)
  263. return
  264. options = []
  265. for option in group._group_actions:
  266. if option.metavar:
  267. option_fmt = '``%%s %s``' % option.metavar
  268. else:
  269. option_fmt = '``%s``'
  270. option_str = ', '.join(option_fmt % s for s in option.option_strings)
  271. options.append((option_str, option))
  272. for option_str, option in options:
  273. help = textwrap.indent(get_help(option), ' ' * 4)
  274. text.append(option_str)
  275. text.append(help)
  276. shipout(text)
  277. class build_man(Command):
  278. description = 'build man pages'
  279. user_options = []
  280. see_also = {
  281. 'create': ('delete', 'prune', 'check', 'patterns', 'placeholders', 'compression'),
  282. 'recreate': ('patterns', 'placeholders', 'compression'),
  283. 'list': ('info', 'diff', 'prune', 'patterns'),
  284. 'info': ('list', 'diff'),
  285. 'init': ('create', 'delete', 'check', 'list', 'key-import', 'key-export', 'key-change-passphrase'),
  286. 'key-import': ('key-export', ),
  287. 'key-export': ('key-import', ),
  288. 'mount': ('umount', 'extract'), # Would be cooler if these two were on the same page
  289. 'umount': ('mount', ),
  290. 'extract': ('mount', ),
  291. }
  292. rst_prelude = textwrap.dedent("""
  293. .. role:: ref(title)
  294. .. |project_name| replace:: Borg
  295. """)
  296. def initialize_options(self):
  297. pass
  298. def finalize_options(self):
  299. pass
  300. def run(self):
  301. print('building man pages (in docs/man)', file=sys.stderr)
  302. os.makedirs('docs/man', exist_ok=True)
  303. # allows us to build docs without the C modules fully loaded during help generation
  304. from borg.archiver import Archiver
  305. parser = Archiver(prog='borg').parser
  306. self.generate_level('', parser, Archiver)
  307. self.build_topic_pages(Archiver)
  308. def generate_level(self, prefix, parser, Archiver):
  309. is_subcommand = False
  310. choices = {}
  311. for action in parser._actions:
  312. if action.choices is not None and 'SubParsersAction' in str(action.__class__):
  313. is_subcommand = True
  314. for cmd, parser in action.choices.items():
  315. choices[prefix + cmd] = parser
  316. if prefix and not choices:
  317. return
  318. for command, parser in sorted(choices.items()):
  319. if command.startswith('debug') or command == 'help':
  320. continue
  321. man_title = 'borg-' + command.replace(' ', '-')
  322. print('building man page', man_title + '(1)', file=sys.stderr)
  323. if self.generate_level(command + ' ', parser, Archiver):
  324. continue
  325. doc, write = self.new_doc()
  326. self.write_man_header(write, man_title, parser.description)
  327. self.write_heading(write, 'SYNOPSIS')
  328. write('borg', command, end='')
  329. self.write_usage(write, parser)
  330. write('\n')
  331. self.write_heading(write, 'DESCRIPTION')
  332. write(parser.epilog)
  333. self.write_heading(write, 'OPTIONS')
  334. write('See `borg-common(1)` for common options of Borg commands.')
  335. write()
  336. self.write_options(write, parser)
  337. self.write_examples(write, command)
  338. self.write_see_also(write, man_title)
  339. self.gen_man_page(man_title, doc.getvalue())
  340. # Generate the borg-common(1) man page with the common options.
  341. if 'create' in choices:
  342. doc, write = self.new_doc()
  343. man_title = 'borg-common'
  344. self.write_man_header(write, man_title, 'Common options of Borg commands')
  345. common_options = [group for group in choices['create']._action_groups if group.title == 'Common options'][0]
  346. self.write_heading(write, 'SYNOPSIS')
  347. self.write_options_group(write, common_options)
  348. self.write_see_also(write, man_title)
  349. self.gen_man_page(man_title, doc.getvalue())
  350. return is_subcommand
  351. def build_topic_pages(self, Archiver):
  352. for topic, text in Archiver.helptext.items():
  353. doc, write = self.new_doc()
  354. man_title = 'borg-' + topic
  355. print('building man page', man_title + '(1)', file=sys.stderr)
  356. self.write_man_header(write, man_title, 'Details regarding ' + topic)
  357. self.write_heading(write, 'DESCRIPTION')
  358. write(text)
  359. self.gen_man_page(man_title, doc.getvalue())
  360. def new_doc(self):
  361. doc = io.StringIO(self.rst_prelude)
  362. doc.read()
  363. write = self.printer(doc)
  364. return doc, write
  365. def printer(self, fd):
  366. def write(*args, **kwargs):
  367. print(*args, file=fd, **kwargs)
  368. return write
  369. def write_heading(self, write, header, char='-', double_sided=False):
  370. write()
  371. if double_sided:
  372. write(char * len(header))
  373. write(header)
  374. write(char * len(header))
  375. write()
  376. def write_man_header(self, write, title, description):
  377. self.write_heading(write, title, '=', double_sided=True)
  378. self.write_heading(write, description, double_sided=True)
  379. # man page metadata
  380. write(':Author: The Borg Collective')
  381. write(':Date:', datetime.utcnow().date().isoformat())
  382. write(':Manual section: 1')
  383. write(':Manual group: borg backup tool')
  384. write()
  385. def write_examples(self, write, command):
  386. with open('docs/usage.rst') as fd:
  387. usage = fd.read()
  388. usage_include = '.. include:: usage/%s.rst.inc' % command
  389. begin = usage.find(usage_include)
  390. end = usage.find('.. include', begin + 1)
  391. examples = usage[begin:end]
  392. examples = examples.replace(usage_include, '')
  393. examples = examples.replace('Examples\n~~~~~~~~', '')
  394. examples = examples.replace('Miscellaneous Help\n------------------', '')
  395. examples = re.sub('^(~+)$', lambda matches: '+' * len(matches.group(0)), examples, flags=re.MULTILINE)
  396. examples = examples.strip()
  397. if examples:
  398. self.write_heading(write, 'EXAMPLES', '-')
  399. write(examples)
  400. def write_see_also(self, write, man_title):
  401. see_also = self.see_also.get(man_title.replace('borg-', ''), ())
  402. see_also = ['`borg-%s(1)`' % s for s in see_also]
  403. see_also.insert(0, '`borg-common(1)`')
  404. self.write_heading(write, 'SEE ALSO')
  405. write(', '.join(see_also))
  406. def gen_man_page(self, name, rst):
  407. from docutils.writers import manpage
  408. from docutils.core import publish_string
  409. man_page = publish_string(source=rst, writer=manpage.Writer())
  410. with open('docs/man/%s.1' % name, 'wb') as fd:
  411. fd.write(man_page)
  412. def write_usage(self, write, parser):
  413. if any(len(o.option_strings) for o in parser._actions):
  414. write(' <options> ', end='')
  415. for option in parser._actions:
  416. if option.option_strings:
  417. continue
  418. write(option.metavar, end=' ')
  419. def write_options(self, write, parser):
  420. for group in parser._action_groups:
  421. if group.title == 'Common options' or not group._group_actions:
  422. continue
  423. title = 'arguments' if group.title == 'positional arguments' else group.title
  424. self.write_heading(write, title, '+')
  425. self.write_options_group(write, group)
  426. def write_options_group(self, write, group):
  427. def is_positional_group(group):
  428. return any(not o.option_strings for o in group._group_actions)
  429. if is_positional_group(group):
  430. for option in group._group_actions:
  431. write(option.metavar)
  432. write(textwrap.indent(option.help or '', ' ' * 4))
  433. return
  434. opts = OrderedDict()
  435. for option in group._group_actions:
  436. if option.metavar:
  437. option_fmt = '%s ' + option.metavar
  438. else:
  439. option_fmt = '%s'
  440. option_str = ', '.join(option_fmt % s for s in option.option_strings)
  441. option_desc = textwrap.dedent((option.help or '') % option.__dict__)
  442. opts[option_str] = textwrap.indent(option_desc, ' ' * 4)
  443. padding = len(max(opts)) + 1
  444. for option, desc in opts.items():
  445. write(option.ljust(padding), desc)
  446. class build_api(Command):
  447. description = "generate a basic api.rst file based on the modules available"
  448. user_options = [
  449. ('output=', 'O', 'output directory'),
  450. ]
  451. def initialize_options(self):
  452. pass
  453. def finalize_options(self):
  454. pass
  455. def run(self):
  456. print("auto-generating API documentation")
  457. with open("docs/api.rst", "w") as doc:
  458. doc.write("""
  459. API Documentation
  460. =================
  461. """)
  462. for mod in glob('src/borg/*.py') + glob('src/borg/*.pyx'):
  463. print("examining module %s" % mod)
  464. mod = mod.replace('.pyx', '').replace('.py', '').replace('/', '.')
  465. if "._" not in mod:
  466. doc.write("""
  467. .. automodule:: %s
  468. :members:
  469. :undoc-members:
  470. """ % mod)
  471. cmdclass = {
  472. 'build_ext': build_ext,
  473. 'build_api': build_api,
  474. 'build_usage': build_usage,
  475. 'build_man': build_man,
  476. 'sdist': Sdist
  477. }
  478. ext_modules = []
  479. if not on_rtd:
  480. ext_modules += [
  481. Extension('borg.compress', [compress_source], libraries=['lz4'], include_dirs=include_dirs, library_dirs=library_dirs, define_macros=define_macros),
  482. Extension('borg.crypto', [crypto_source], libraries=crypto_libraries, include_dirs=include_dirs, library_dirs=library_dirs, define_macros=define_macros),
  483. Extension('borg.chunker', [chunker_source]),
  484. Extension('borg.hashindex', [hashindex_source]),
  485. Extension('borg.item', [item_source]),
  486. Extension('borg.crc32', [crc32_source]),
  487. ]
  488. if not sys.platform.startswith(('win32', )):
  489. ext_modules.append(Extension('borg.platform.posix', [platform_posix_source]))
  490. if sys.platform == 'linux':
  491. ext_modules.append(Extension('borg.platform.linux', [platform_linux_source], libraries=['acl']))
  492. elif sys.platform.startswith('freebsd'):
  493. ext_modules.append(Extension('borg.platform.freebsd', [platform_freebsd_source]))
  494. elif sys.platform == 'darwin':
  495. ext_modules.append(Extension('borg.platform.darwin', [platform_darwin_source]))
  496. setup(
  497. name='borgbackup',
  498. use_scm_version={
  499. 'write_to': 'src/borg/_version.py',
  500. },
  501. author='The Borg Collective (see AUTHORS file)',
  502. author_email='borgbackup@python.org',
  503. url='https://borgbackup.readthedocs.io/',
  504. description='Deduplicated, encrypted, authenticated and compressed backups',
  505. long_description=long_description,
  506. license='BSD',
  507. platforms=['Linux', 'MacOS X', 'FreeBSD', 'OpenBSD', 'NetBSD', ],
  508. classifiers=[
  509. 'Development Status :: 4 - Beta',
  510. 'Environment :: Console',
  511. 'Intended Audience :: System Administrators',
  512. 'License :: OSI Approved :: BSD License',
  513. 'Operating System :: POSIX :: BSD :: FreeBSD',
  514. 'Operating System :: POSIX :: BSD :: OpenBSD',
  515. 'Operating System :: POSIX :: BSD :: NetBSD',
  516. 'Operating System :: MacOS :: MacOS X',
  517. 'Operating System :: POSIX :: Linux',
  518. 'Programming Language :: Python',
  519. 'Programming Language :: Python :: 3',
  520. 'Programming Language :: Python :: 3.4',
  521. 'Programming Language :: Python :: 3.5',
  522. 'Programming Language :: Python :: 3.6',
  523. 'Topic :: Security :: Cryptography',
  524. 'Topic :: System :: Archiving :: Backup',
  525. ],
  526. packages=find_packages('src'),
  527. package_dir={'': 'src'},
  528. include_package_data=True,
  529. zip_safe=False,
  530. entry_points={
  531. 'console_scripts': [
  532. 'borg = borg.archiver:main',
  533. 'borgfs = borg.archiver:main',
  534. ]
  535. },
  536. cmdclass=cmdclass,
  537. ext_modules=ext_modules,
  538. setup_requires=['setuptools_scm>=1.7'],
  539. install_requires=install_requires,
  540. extras_require=extras_require,
  541. )