Skip to content

Commit 2010cba

Browse files
committed
fix platform
1 parent eec48ee commit 2010cba

3 files changed

Lines changed: 9 additions & 17 deletions

File tree

wagon/tests/test_wagon.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,9 @@ def test_wheel_nonexisting_package(self):
130130

131131
def test_machine_platform(self):
132132
if utils.IS_WIN:
133-
self.assertIn('win', utils.get_machine_platform().lower())
133+
self.assertIn('win32', utils.get_platform())
134134
else:
135-
self.assertEqual(utils.get_machine_platform(), 'linux_x86_64')
135+
self.assertEqual(utils.get_platform(), 'linux_x86_64')
136136

137137

138138
class TestCreateBadSources(testtools.TestCase):
@@ -171,7 +171,7 @@ def tearDown(self):
171171
shutil.rmtree(TEST_PACKAGE_NAME)
172172

173173
def _test(self):
174-
# self.assertTrue(os.path.isfile(self.archive_name))
174+
self.assertTrue(os.path.isfile(self.archive_name))
175175
utils.untar(self.archive_name, '.')
176176
with open(os.path.join(
177177
TEST_PACKAGE_NAME,
@@ -245,7 +245,7 @@ def test_create_archive_from_url_with_requirements(self):
245245
if utils.IS_WIN:
246246
self.wagon.platform = 'win32'
247247
else:
248-
self.wagon.platform = utils.get_machine_platform()
248+
self.wagon.platform = utils.get_platform()
249249
self.archive_name = self.wagon.set_archive_name(
250250
TEST_PACKAGE_NAME, TEST_PACKAGE_VERSION)
251251
params = {

wagon/utils.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
from contextlib import closing
1111
import platform
1212

13+
from wheel import pep425tags as wheel_tags
14+
1315
import codes
1416
import logger
1517

@@ -223,18 +225,8 @@ def get_python_version():
223225
return 'py{0}{1}'.format(version[0], version[1])
224226

225227

226-
def get_machine_platform():
227-
system = platform.system().lower()
228-
machine = platform.machine().lower()
229-
id = 'unidentified'
230-
if system and machine:
231-
id = '{0}_{1}'.format(system, machine)
232-
elif system:
233-
id = system
234-
elif machine:
235-
id = machine
236-
lgr.info('Identified machine platform: {0}'.format(id))
237-
return id
228+
def get_platform():
229+
return wheel_tags.get_platform()
238230

239231

240232
def get_os_properties():

wagon/wagon.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def install(self, virtualenv=None, requirements_file=None, upgrade=False,
141141
if not ignore_platform and supported_platform != 'any':
142142
lgr.debug('Validating Platform {0} is supported...'.format(
143143
supported_platform))
144-
machine_platform = utils.get_machine_platform()
144+
machine_platform = utils.get_platform()
145145
if machine_platform != supported_platform:
146146
lgr.error('Platform unsupported for package ({0}).'.format(
147147
machine_platform))

0 commit comments

Comments
 (0)