Skip to content

Commit 45e3221

Browse files
cclaussrvagg
authored andcommitted
Remove an outdated workaround for Python 2.4
PR-URL: #1650 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
1 parent 997bc3c commit 45e3221

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

gyp/pylib/gyp/MSVSNew.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,12 @@
44

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

7+
import hashlib
78
import os
89
import random
910

1011
import gyp.common
1112

12-
# hashlib is supplied as of Python 2.5 as the replacement interface for md5
13-
# and other secure hashes. In 2.6, md5 is deprecated. Import hashlib if
14-
# available, avoiding a deprecation warning under 2.6. Import md5 otherwise,
15-
# preserving 2.4 compatibility.
16-
try:
17-
import hashlib
18-
_new_md5 = hashlib.md5
19-
except ImportError:
20-
import md5
21-
_new_md5 = md5.new
22-
2313

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

0 commit comments

Comments
 (0)