Skip to content

Commit

Permalink
Remove an outdated workaround for Python 2.4
Browse files Browse the repository at this point in the history
PR-URL: #1650
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
  • Loading branch information
cclauss authored and rvagg committed Apr 24, 2019
1 parent 997bc3c commit 45e3221
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions gyp/pylib/gyp/MSVSNew.py
Expand Up @@ -4,22 +4,12 @@

"""New implementation of Visual Studio project generation."""

import hashlib
import os
import random

import gyp.common

# hashlib is supplied as of Python 2.5 as the replacement interface for md5
# and other secure hashes. In 2.6, md5 is deprecated. Import hashlib if
# available, avoiding a deprecation warning under 2.6. Import md5 otherwise,
# preserving 2.4 compatibility.
try:
import hashlib
_new_md5 = hashlib.md5
except ImportError:
import md5
_new_md5 = md5.new


# Initialize random number generator
random.seed()
Expand Down Expand Up @@ -50,7 +40,7 @@ def MakeGuid(name, seed='msvs_new'):
not change when the project for a target is rebuilt.
"""
# Calculate a MD5 signature for the seed and name.
d = _new_md5(str(seed) + str(name)).hexdigest().upper()
d = hashlib.md5(str(seed) + str(name)).hexdigest().upper()
# Convert most of the signature to GUID form (discard the rest)
guid = ('{' + d[:8] + '-' + d[8:12] + '-' + d[12:16] + '-' + d[16:20]
+ '-' + d[20:32] + '}')
Expand Down

0 comments on commit 45e3221

Please sign in to comment.