Skip to content

Commit

Permalink
fix platform
Browse files Browse the repository at this point in the history
  • Loading branch information
nir0s committed Oct 22, 2015
1 parent eec48ee commit 2010cba
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 17 deletions.
8 changes: 4 additions & 4 deletions wagon/tests/test_wagon.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ def test_wheel_nonexisting_package(self):

def test_machine_platform(self):
if utils.IS_WIN:
self.assertIn('win', utils.get_machine_platform().lower())
self.assertIn('win32', utils.get_platform())
else:
self.assertEqual(utils.get_machine_platform(), 'linux_x86_64')
self.assertEqual(utils.get_platform(), 'linux_x86_64')


class TestCreateBadSources(testtools.TestCase):
Expand Down Expand Up @@ -171,7 +171,7 @@ def tearDown(self):
shutil.rmtree(TEST_PACKAGE_NAME)

def _test(self):
# self.assertTrue(os.path.isfile(self.archive_name))
self.assertTrue(os.path.isfile(self.archive_name))
utils.untar(self.archive_name, '.')
with open(os.path.join(
TEST_PACKAGE_NAME,
Expand Down Expand Up @@ -245,7 +245,7 @@ def test_create_archive_from_url_with_requirements(self):
if utils.IS_WIN:
self.wagon.platform = 'win32'
else:
self.wagon.platform = utils.get_machine_platform()
self.wagon.platform = utils.get_platform()
self.archive_name = self.wagon.set_archive_name(
TEST_PACKAGE_NAME, TEST_PACKAGE_VERSION)
params = {
Expand Down
16 changes: 4 additions & 12 deletions wagon/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
from contextlib import closing
import platform

from wheel import pep425tags as wheel_tags

import codes
import logger

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


def get_machine_platform():
system = platform.system().lower()
machine = platform.machine().lower()
id = 'unidentified'
if system and machine:
id = '{0}_{1}'.format(system, machine)
elif system:
id = system
elif machine:
id = machine
lgr.info('Identified machine platform: {0}'.format(id))
return id
def get_platform():
return wheel_tags.get_platform()


def get_os_properties():
Expand Down
2 changes: 1 addition & 1 deletion wagon/wagon.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def install(self, virtualenv=None, requirements_file=None, upgrade=False,
if not ignore_platform and supported_platform != 'any':
lgr.debug('Validating Platform {0} is supported...'.format(
supported_platform))
machine_platform = utils.get_machine_platform()
machine_platform = utils.get_platform()
if machine_platform != supported_platform:
lgr.error('Platform unsupported for package ({0}).'.format(
machine_platform))
Expand Down

0 comments on commit 2010cba

Please sign in to comment.