mirror of https://github.com/borgbackup/borg.git
Minor Windows fixes.
This commit is contained in:
parent
401155e909
commit
f3543c28fd
|
@ -32,7 +32,7 @@ if gccpath == '':
|
||||||
source = open('wrapper.c', 'w')
|
source = open('wrapper.c', 'w')
|
||||||
source.write(
|
source.write(
|
||||||
"""
|
"""
|
||||||
#include <python""" + pythonversion +"""m/python.h>
|
#include <python""" + pythonversion + """m/python.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -104,6 +104,7 @@ def finddlls(exe):
|
||||||
re.append(dll)
|
re.append(dll)
|
||||||
return re
|
return re
|
||||||
|
|
||||||
|
|
||||||
items = finder.modules.items()
|
items = finder.modules.items()
|
||||||
for name, mod in items:
|
for name, mod in items:
|
||||||
file = mod.__file__
|
file = mod.__file__
|
||||||
|
@ -137,9 +138,9 @@ library.write(os.path.join(modulepath, 'lib-dynload/_sysconfigdata_m_win32_.py')
|
||||||
library.write(os.path.join(modulepath, 'ctypes/wintypes.py'), 'ctypes/wintypes.py')
|
library.write(os.path.join(modulepath, 'ctypes/wintypes.py'), 'ctypes/wintypes.py')
|
||||||
|
|
||||||
for extmodule in ['src/borg/chunker-cpython-' + str(sys.version_info[0]) + str(sys.version_info[1]) + 'm.dll',
|
for extmodule in ['src/borg/chunker-cpython-' + str(sys.version_info[0]) + str(sys.version_info[1]) + 'm.dll',
|
||||||
'src/borg/compress-cpython-' + str(sys.version_info[0]) + str(sys.version_info[1]) + 'm.dll',
|
'src/borg/compress-cpython-' + str(sys.version_info[0]) + str(sys.version_info[1]) + 'm.dll',
|
||||||
'src/borg/item-cpython-' + str(sys.version_info[0]) + str(sys.version_info[1]) + 'm.dll',
|
'src/borg/item-cpython-' + str(sys.version_info[0]) + str(sys.version_info[1]) + 'm.dll',
|
||||||
'src/borg/hashindex-cpython-' + str(sys.version_info[0]) + str(sys.version_info[1]) + 'm.dll']:
|
'src/borg/hashindex-cpython-' + str(sys.version_info[0]) + str(sys.version_info[1]) + 'm.dll']:
|
||||||
for dll in finddlls(extmodule):
|
for dll in finddlls(extmodule):
|
||||||
if builddir not in dll:
|
if builddir not in dll:
|
||||||
shutil.copyfile(dll, os.path.join(builddir, os.path.split(dll)[1]))
|
shutil.copyfile(dll, os.path.join(builddir, os.path.split(dll)[1]))
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -759,6 +759,7 @@ class Clean(clean):
|
||||||
for compiled in sorted(glob(compiled_glob)):
|
for compiled in sorted(glob(compiled_glob)):
|
||||||
rm(compiled)
|
rm(compiled)
|
||||||
|
|
||||||
|
|
||||||
cmdclass = {
|
cmdclass = {
|
||||||
'build_ext': build_ext,
|
'build_ext': build_ext,
|
||||||
'build_usage': build_usage,
|
'build_usage': build_usage,
|
||||||
|
@ -797,6 +798,7 @@ def parse(root, describe_command=None):
|
||||||
file.write('version = "' + output + '"\n')
|
file.write('version = "' + output + '"\n')
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
|
||||||
parse_function = parse if sys.platform == 'win32' else None
|
parse_function = parse if sys.platform == 'win32' else None
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
|
|
|
@ -28,6 +28,7 @@ from ..constants import * # NOQA
|
||||||
if sys.platform == 'win32':
|
if sys.platform == 'win32':
|
||||||
import posixpath
|
import posixpath
|
||||||
|
|
||||||
|
|
||||||
def bin_to_hex(binary):
|
def bin_to_hex(binary):
|
||||||
return hexlify(binary).decode('ascii')
|
return hexlify(binary).decode('ascii')
|
||||||
|
|
||||||
|
@ -365,7 +366,7 @@ class Location:
|
||||||
""" + optional_archive_re, re.VERBOSE) # archive name (optional, may be empty)
|
""" + optional_archive_re, re.VERBOSE) # archive name (optional, may be empty)
|
||||||
|
|
||||||
win_file_re = re.compile(r'(?:file://)?(?P<path>(?:[a-zA-Z]:[\\/])?(?:[^:]*))' + optional_archive_re, re.VERBOSE)
|
win_file_re = re.compile(r'(?:file://)?(?P<path>(?:[a-zA-Z]:[\\/])?(?:[^:]*))' + optional_archive_re, re.VERBOSE)
|
||||||
|
|
||||||
def __init__(self, text=''):
|
def __init__(self, text=''):
|
||||||
self.orig = text
|
self.orig = text
|
||||||
if not self.parse(self.orig):
|
if not self.parse(self.orig):
|
||||||
|
@ -392,7 +393,10 @@ class Location:
|
||||||
def normpath_special(p):
|
def normpath_special(p):
|
||||||
# avoid that normpath strips away our relative path hack and even makes p absolute
|
# avoid that normpath strips away our relative path hack and even makes p absolute
|
||||||
relative = p.startswith('/./')
|
relative = p.startswith('/./')
|
||||||
p = os.path.normpath(p)
|
if sys.platform != 'win32':
|
||||||
|
p = os.path.normpath(p)
|
||||||
|
else:
|
||||||
|
p = posixpath.normpath(p)
|
||||||
return ('/.' + p) if relative else p
|
return ('/.' + p) if relative else p
|
||||||
if sys.platform != 'win32':
|
if sys.platform != 'win32':
|
||||||
m = self.ssh_re.match(text)
|
m = self.ssh_re.match(text)
|
||||||
|
@ -422,7 +426,7 @@ class Location:
|
||||||
m = self.win_file_re.match(text)
|
m = self.win_file_re.match(text)
|
||||||
if m:
|
if m:
|
||||||
self.proto = 'file'
|
self.proto = 'file'
|
||||||
self.path = posixpath.normpath(m.group('path'))
|
self.path = os.path.normpath(m.group('path').replace('/', '\\'))
|
||||||
self.archive = m.group('archive')
|
self.archive = m.group('archive')
|
||||||
return True
|
return True
|
||||||
m = self.ssh_re.match(text)
|
m = self.ssh_re.match(text)
|
||||||
|
@ -434,7 +438,7 @@ class Location:
|
||||||
self.path = normpath_special(m.group('path'))
|
self.path = normpath_special(m.group('path'))
|
||||||
self.archive = m.group('archive')
|
self.archive = m.group('archive')
|
||||||
return True
|
return True
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
|
Loading…
Reference in New Issue