Skip to content

Commit abb3b90

Browse files
committed
Add native Windows support
1 parent cd907a8 commit abb3b90

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

setup.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"""
1313

1414
import os
15+
import sys
1516
import runpy
1617

1718
from setuptools import setup
@@ -26,7 +27,9 @@ def get_version():
2627

2728
setup(
2829
name="wpm",
29-
scripts=["scripts/wpm"],
30+
entry_points = {
31+
"console_scripts": ['wpm = wpm.commandline:main']
32+
},
3033
version=_VERSION,
3134
description="Console app for measuring typing speed in words per minute (WPM)",
3235
author="Christian Stigen Larsen",
@@ -35,14 +38,15 @@ def get_version():
3538
package_dir={"wpm": "wpm"},
3639
package_data={"wpm": ["data/examples.json.gz"]},
3740
include_package_data=True,
41+
install_requires=(["windows-curses"] if sys.platform.startswith("win") else []),
3842
url="https://github.com/cslarsen/wpm",
3943
download_url="https://github.com/cslarsen/wpm/tarball/v%s" % _VERSION,
4044
license="https://www.gnu.org/licenses/agpl-3.0.html",
4145
long_description=open("README.rst").read(),
4246
zip_safe=True,
4347
test_suite="tests",
4448
keywords=["wpm", "typing", "typist"],
45-
platforms=["unix", "linux", "osx", "cygwin"],
49+
platforms=["unix", "linux", "osx", "cygwin", "win32"],
4650
classifiers=[
4751
"Development Status :: 3 - Alpha",
4852
"Environment :: Console",

wpm/screen.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def lines(self):
150150

151151
def set_colors(self):
152152
"""Sets up curses color pairs."""
153-
hicolor = os.getenv("TERM").endswith("256color")
153+
hicolor = os.getenv("TERM").endswith("256color") if os.getenv("TERM") else None
154154

155155
if hicolor:
156156
color = self.config.xterm256colors

wpm/stats.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,4 +254,6 @@ def save(self, filename):
254254
game[0] = 1 + race
255255
writer.writerow(game)
256256

257+
if os.path.exists(filename):
258+
os.remove(filename)
257259
os.rename(filename + ".tmp", filename)

0 commit comments

Comments
 (0)