##// END OF EJS Templates
dependencies: bind sqlite with hgsubversion
marcink -
r320:b2ca4cbc default
parent child Browse files
Show More
@@ -1,47 +1,54 b''
1 1 # Overrides for the generated python-packages.nix
2 2 #
3 3 # This function is intended to be used as an extension to the generated file
4 4 # python-packages.nix. The main objective is to add needed dependencies of C
5 5 # libraries and tweak the build instructions where needed.
6 6
7 7 { pkgs, basePythonPackages }:
8 8
9 9 let
10 10 sed = "sed -i";
11 11 in
12 12
13 13 self: super: {
14 14
15 15 subvertpy = super.subvertpy.override (attrs: {
16 16 # TODO: johbo: Remove the "or" once we drop 16.03 support
17 17 SVN_PREFIX = "${pkgs.subversion.dev or pkgs.subversion}";
18 18 propagatedBuildInputs = attrs.propagatedBuildInputs ++ [
19 19 pkgs.aprutil
20 20 pkgs.subversion
21 21 ];
22 22 preBuild = pkgs.lib.optionalString pkgs.stdenv.isDarwin ''
23 23 ${sed} -e "s/'gcc'/'clang'/" setup.py
24 24 '';
25 25 });
26 26
27 hgsubversion = super.hgsubversion.override (attrs: {
28 propagatedBuildInputs = attrs.propagatedBuildInputs ++ [
29 pkgs.sqlite
30 basePythonPackages.sqlite3
31 ];
32 });
33
27 34 mercurial = super.mercurial.override (attrs: {
28 35 propagatedBuildInputs = attrs.propagatedBuildInputs ++ [
29 36 self.python.modules.curses
30 37 ] ++ pkgs.lib.optional pkgs.stdenv.isDarwin
31 38 pkgs.darwin.apple_sdk.frameworks.ApplicationServices;
32 39 });
33 40
34 41 pyramid = super.pyramid.override (attrs: {
35 42 postFixup = ''
36 43 wrapPythonPrograms
37 44 # TODO: johbo: "wrapPython" adds this magic line which
38 45 # confuses pserve.
39 46 ${sed} '/import sys; sys.argv/d' $out/bin/.pserve-wrapped
40 47 '';
41 48 });
42 49
43 50 # Avoid that setuptools is replaced, this leads to trouble
44 51 # with buildPythonPackage.
45 52 setuptools = basePythonPackages.setuptools;
46 53
47 54 }
@@ -1,125 +1,130 b''
1 1 # RhodeCode VCSServer provides access to different vcs backends via network.
2 2 # Copyright (C) 2014-2017 RodeCode GmbH
3 3 #
4 4 # This program is free software; you can redistribute it and/or modify
5 5 # it under the terms of the GNU General Public License as published by
6 6 # the Free Software Foundation; either version 3 of the License, or
7 7 # (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software Foundation,
16 16 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 17
18 18 import mock
19 19 import pytest
20 20
21 21 from vcsserver import hgcompat, hgpatches
22 22
23 23
24 24 LARGEFILES_CAPABILITY = 'largefiles=serve'
25 25
26 26
27 27 def test_patch_largefiles_capabilities_applies_patch(
28 28 patched_capabilities):
29 29 lfproto = hgcompat.largefiles.proto
30 30 hgpatches.patch_largefiles_capabilities()
31 31 assert lfproto.capabilities.func_name == '_dynamic_capabilities'
32 32
33 33
34 34 def test_dynamic_capabilities_uses_original_function_if_not_enabled(
35 35 stub_repo, stub_proto, stub_ui, stub_extensions, patched_capabilities):
36 36 dynamic_capabilities = hgpatches._dynamic_capabilities_wrapper(
37 37 hgcompat.largefiles.proto, stub_extensions)
38 38
39 39 caps = dynamic_capabilities(stub_repo, stub_proto)
40 40
41 41 stub_extensions.assert_called_once_with(stub_ui)
42 42 assert LARGEFILES_CAPABILITY not in caps
43 43
44 44
45 45 def test_dynamic_capabilities_uses_updated_capabilitiesorig(
46 46 stub_repo, stub_proto, stub_ui, stub_extensions, patched_capabilities):
47 47 dynamic_capabilities = hgpatches._dynamic_capabilities_wrapper(
48 48 hgcompat.largefiles.proto, stub_extensions)
49 49
50 50 # This happens when the extension is loaded for the first time, important
51 51 # to ensure that an updated function is correctly picked up.
52 52 hgcompat.largefiles.proto.capabilitiesorig = mock.Mock(
53 53 return_value='REPLACED')
54 54
55 55 caps = dynamic_capabilities(stub_repo, stub_proto)
56 56 assert 'REPLACED' == caps
57 57
58 58
59 59 def test_dynamic_capabilities_ignores_updated_capabilities(
60 60 stub_repo, stub_proto, stub_ui, stub_extensions, patched_capabilities):
61 61 stub_extensions.return_value = [('largefiles', mock.Mock())]
62 62 dynamic_capabilities = hgpatches._dynamic_capabilities_wrapper(
63 63 hgcompat.largefiles.proto, stub_extensions)
64 64
65 65 # This happens when the extension is loaded for the first time, important
66 66 # to ensure that an updated function is correctly picked up.
67 67 hgcompat.largefiles.proto.capabilities = mock.Mock(
68 68 side_effect=Exception('Must not be called'))
69 69
70 70 dynamic_capabilities(stub_repo, stub_proto)
71 71
72 72
73 73 def test_dynamic_capabilities_uses_largefiles_if_enabled(
74 74 stub_repo, stub_proto, stub_ui, stub_extensions, patched_capabilities):
75 75 stub_extensions.return_value = [('largefiles', mock.Mock())]
76 76
77 77 dynamic_capabilities = hgpatches._dynamic_capabilities_wrapper(
78 78 hgcompat.largefiles.proto, stub_extensions)
79 79
80 80 caps = dynamic_capabilities(stub_repo, stub_proto)
81 81
82 82 stub_extensions.assert_called_once_with(stub_ui)
83 83 assert LARGEFILES_CAPABILITY in caps
84 84
85 85
86 def test_hgsubversion_import():
87 from hgsubversion import svnrepo
88 assert svnrepo
89
90
86 91 @pytest.fixture
87 92 def patched_capabilities(request):
88 93 """
89 94 Patch in `capabilitiesorig` and restore both capability functions.
90 95 """
91 96 lfproto = hgcompat.largefiles.proto
92 97 orig_capabilities = lfproto.capabilities
93 98 orig_capabilitiesorig = lfproto.capabilitiesorig
94 99
95 100 lfproto.capabilitiesorig = mock.Mock(return_value='ORIG')
96 101
97 102 @request.addfinalizer
98 103 def restore():
99 104 lfproto.capabilities = orig_capabilities
100 105 lfproto.capabilitiesorig = orig_capabilitiesorig
101 106
102 107
103 108 @pytest.fixture
104 109 def stub_repo(stub_ui):
105 110 repo = mock.Mock()
106 111 repo.ui = stub_ui
107 112 return repo
108 113
109 114
110 115 @pytest.fixture
111 116 def stub_proto(stub_ui):
112 117 proto = mock.Mock()
113 118 proto.ui = stub_ui
114 119 return proto
115 120
116 121
117 122 @pytest.fixture
118 123 def stub_ui():
119 124 return hgcompat.ui.ui()
120 125
121 126
122 127 @pytest.fixture
123 128 def stub_extensions():
124 129 extensions = mock.Mock(return_value=tuple())
125 130 return extensions
General Comments 0
You need to be logged in to leave comments. Login now