From 583381c61228d8f43c510a4045c689d0f6c89f6e Mon Sep 17 00:00:00 2001 From: Claudiu Popa Date: Sun, 26 Oct 2014 22:30:46 +0200 Subject: Use a with statement in setup.py --- setup.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index 4cd2396..b4f8240 100644 --- a/setup.py +++ b/setup.py @@ -109,9 +109,8 @@ class MyInstallLib(install_lib.install_lib): product_init = join(self.install_dir, subpackage_of, '__init__.py') if not exists(product_init): self.announce('creating %s' % product_init) - stream = open(product_init, 'w') - stream.write(EMPTY_FILE) - stream.close() + with open(product_init, 'w') as stream: + stream.write(EMPTY_FILE) # manually install included directories if any if include_dirs: if subpackage_of: -- cgit v1.2.1