Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b031afa

Browse files
committed
install packages using nuget in setup.py
1 parent 71c0f1e commit b031afa

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

.travis.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ before_install:
77
- sudo add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu/ trusty main universe"
88
- sudo apt-get -qq update
99
- sudo apt-get -qq install mono-devel mono-gmcs mono-xbuild nunit-console
10+
- sudo mozroots --import --machine --sync
11+
- yes | sudo certmgr -ssl -m https://go.microsoft.com
12+
- yes | sudo certmgr -ssl -m https://nugetgallery.blob.core.windows.net
13+
- yes | sudo certmgr -ssl -m https://nuget.org
1014
install:
1115
- cd pythonnet
1216
- python setup.py build_ext --inplace

pythonnet/setup.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ def build_extension(self, ext):
8181
if ext.name != "clr":
8282
return build_ext.build_extension(self, ext)
8383

84+
# install packages using nuget
85+
self._install_packages()
86+
8487
dest_file = self.get_ext_fullpath(ext.name)
8588
dest_dir = os.path.dirname(dest_file)
8689
if not os.path.exists(dest_dir):
@@ -164,6 +167,29 @@ def _build_monoclr(self, ext):
164167
debug=self.debug)
165168

166169

170+
def _install_packages(self):
171+
"""install packages using nuget"""
172+
nuget = os.path.join("tools", "nuget", "nuget.exe")
173+
use_shell = False
174+
if DEVTOOLS == "Mono":
175+
nuget = "mono %s" % nuget
176+
use_shell = True
177+
178+
for dir in os.listdir("src"):
179+
if DEVTOOLS == "Mono" and dir == "clrmodule":
180+
continue
181+
if DEVTOOLS != "Mono" and dir == "monoclr":
182+
continue
183+
184+
packages_cfg = os.path.join("src", dir, "packages.config")
185+
if not os.path.exists(packages_cfg):
186+
continue
187+
188+
cmd = "%s install %s -o packages" % (nuget, packages_cfg)
189+
self.announce("Installng packages for %s: %s" % (dir, cmd))
190+
check_call(cmd, shell=use_shell)
191+
192+
167193
class PythonNET_InstallLib(install_lib):
168194

169195
def install(self):

0 commit comments

Comments
 (0)