python3 fixes

This commit is contained in:
2017-01-21 21:28:46 -05:00
parent a5da8d984d
commit 3d023a63d8
3 changed files with 9 additions and 6 deletions
+5 -3
View File
@@ -1,11 +1,13 @@
import toml
import codecs
import json
import hashlib
import platform
import sys
import os
def format_full_version(info):
version = '{0.major}.{0.minor}.{0.micro}'.format(info)
kind = info.releaselevel
@@ -128,12 +130,12 @@ class Pipfile(object):
@property
def hash(self):
"""Returns the SHA256 of the pipfile."""
return hashlib.sha256(self.contents).hexdigest()
return hashlib.sha256(self.contents.encode('utf-8')).hexdigest()
@property
def contents(self):
"""Returns the contents of the pipfile."""
with open(self.filename, 'r') as f:
with codecs.open(self.filename, 'r', 'utf-8') as f:
return f.read()
def freeze(self):
@@ -172,7 +174,7 @@ class Pipfile(object):
}
# Assert each specified requirement.
for marker, specifier in self.data['_meta']['requires'].iteritems():
for marker, specifier in self.data['_meta']['requires'].items():
if marker in lookup:
try:
+3 -2
View File
@@ -297,7 +297,8 @@ def install(package_name=False, dev=False, system=False):
try:
assert c.return_code == 0
except AssertionError:
click.echo('{1} An error occured while installing {1}'.format(crayons.red('Error: '), crayons.green(package_name)))
click.echo('{0} An error occured while installing {1}'.format(crayons.red('Error: '), crayons.green(package_name)))
click.echo(crayons.blue(c.err))
sys.exit(1)
if dev:
@@ -322,7 +323,7 @@ def uninstall(package_name=False, system=False):
do_purge(allow_global=system)
sys.exit(1)
click.echo('Un-installing {1}...'.format(crayons.green(package_name)))
click.echo('Un-installing {0}...'.format(crayons.green(package_name)))
c = delegator.run('{0} uninstall {1} -y'.format(which_pip(allow_global=system), package_name))
click.echo(crayons.blue(c.out))
+1 -1
View File
@@ -81,7 +81,7 @@ class Project(object):
p[key] = {}
package = convert_deps_from_pip(package_name)
package_name = package.keys()[0]
package_name = [k for k in package.keys()][0]
# Add the package to the group.
p[key][package_name] = package[package_name]