smbserver: fix Python 3 compatibility

Python 2's `ConfigParser` module is spelled `configparser` in Python 3.

Closes https://github.com/curl/curl/pull/4484
This commit is contained in:
Marcel Raad 2019-10-13 21:35:56 +02:00
parent a626fa128c
commit ee63837732
No known key found for this signature in database
GPG Key ID: FE4D8BC5EE1701DD

View File

@ -24,11 +24,14 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
# unicode_literals) # unicode_literals)
import argparse import argparse
import ConfigParser
import os import os
import sys import sys
import logging import logging
import tempfile import tempfile
try: # Python 3
import configparser
except ImportError: # Python 2
import ConfigParser as configparser
# Import our curl test data helper # Import our curl test data helper
import curl_test_data import curl_test_data
@ -58,7 +61,7 @@ def smbserver(options):
f.write("{0}".format(pid)) f.write("{0}".format(pid))
# Here we write a mini config for the server # Here we write a mini config for the server
smb_config = ConfigParser.ConfigParser() smb_config = configparser.ConfigParser()
smb_config.add_section("global") smb_config.add_section("global")
smb_config.set("global", "server_name", "SERVICE") smb_config.set("global", "server_name", "SERVICE")
smb_config.set("global", "server_os", "UNIX") smb_config.set("global", "server_os", "UNIX")