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