Skip to content

check and remove osp comments #1163

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Nov 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from __future__ import print_function, with_statement

import os
# import os.path as osp
from pathlib import Path
import re
import shutil
Expand All @@ -25,11 +24,7 @@
def normalize(name):
return re.sub(r"[-_.]+", "-", name).lower()

# CHANGELOGS_DIR = osp.join(
# osp.dirname(__file__), 'changelogs'
# )
CHANGELOGS_DIR = str(Path(__file__).parent / 'changelogs')
# assert osp.isdir(CHANGELOGS_DIR)
assert Path(CHANGELOGS_DIR).is_dir()


Expand Down Expand Up @@ -111,16 +106,6 @@ def __init__(
self.from_file(basedir)

def from_file(self, basedir):
# fname = osp.join(basedir, 'build%s' % self.flavor,
#fname = osp.join(
# CHANGELOGS_DIR,
# 'WinPython%s-%sbit-%s.md'
# % (
# self.flavor,
# self.architecture,
# self.version,
# ),
#)
fname = str(Path(CHANGELOGS_DIR) /
f'WinPython{self.flavor}-{self.architecture}bit-{self.version}.md')

Expand Down Expand Up @@ -214,7 +199,6 @@ def find_closer_version(
version1, basedir=None, flavor='', architecture=64
):
"""Find version which is the closest to `version`"""
# builddir = osp.join(basedir, 'bu%s' % flavor)
builddir = str(Path(basedir) / f'bu{flavor}')
func = lambda name: re.match(
r'WinPython%s-%sbit-([0-9\.]*)\.(txt|md)'
Expand Down Expand Up @@ -311,9 +295,7 @@ def _copy_all_changelogs(
name,
):
shutil.copyfile(
# osp.join(CHANGELOGS_DIR, name),
str(Path(CHANGELOGS_DIR) / name),
# osp.join(basedir, 'bu%s' % flavor, name),
str(Path(basedir) / f'bu{flavor}' / name),
)

Expand Down Expand Up @@ -347,12 +329,6 @@ def write_changelog(
flavor=flavor,
architecture=architecture,
)
#fname = osp.join(
# basedir,
# 'bu%s' % flavor,
# 'WinPython%s-%sbit-%s_History.md'
# % (flavor, architecture, version2),
#)
fname = str(Path(basedir) /
f'bu{flavor}' /
f'WinPython{flavor}-{architecture}bit-{version2}_History.md')
Expand All @@ -364,7 +340,6 @@ def write_changelog(
fdesc.write(text)
# Copy to winpython/changelogs
shutil.copyfile(
#fname, osp.join(CHANGELOGS_DIR, osp.basename(fname))
fname, str(Path(CHANGELOGS_DIR) / Path(fname).name)
)

Expand Down
13 changes: 0 additions & 13 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

from distutils.core import setup
import os
# import os.path as osp
from pathlib import Path

def get_package_data(name, extlist):
Expand All @@ -28,11 +27,9 @@ def get_package_data(name, extlist):
for fname in filenames:
if (
not fname.startswith('.')
# and osp.splitext(fname)[1] in extlist
and Path(fname).suffix in extlist
):
flist.append(
# osp.join(dirpath, fname)[offset:]
str(Path(dirpath) / fname)[offset:]
)
return flist
Expand All @@ -42,8 +39,6 @@ def get_subpackages(name):
"""Return subpackages of package *name*"""
splist = []
for dirpath, _dirnames, _filenames in os.walk(name):
# if osp.isfile(osp.join(dirpath, '__init__.py')):
# if osp.isfile(str(Path(dirpath) / '__init__.py')):
if (Path(dirpath) / '__init__.py').is_file():
splist.append(".".join(dirpath.split(os.sep)))
return splist
Expand Down Expand Up @@ -86,14 +81,6 @@ def get_subpackages(name):
),
)
},
# requires=["PyQt4 (>=4.5)"],
#scripts=[
# osp.join('scripts', fname)
# for fname in (
# 'register_python',
# 'register_python.bat',
# )
#],
# use setuptools functionalities
entry_points={
'console_scripts': [
Expand Down
4 changes: 0 additions & 4 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

import sys
import os
# import os.path as osp
from pathlib import Path
import re

Expand All @@ -26,11 +25,8 @@ def test_python_packages(pyver):
"""Check if all Python packages are supported by WinPython"""
basedir = utils.get_basedir(pyver)
for suffix in ('src', 'win32', 'win-amd64'):
# dirname = osp.join(basedir, 'packages.%s' % suffix)
dirname = str(Path(basedir) / f'packages.{suffix}')
for name in os.listdir(dirname):
# if osp.isfile(osp.join(dirname, name)) \
# if osp.isfile(str(Path(dirname) / name)) \
if (Path(dirname) / name).is_file() \
and not re.match(r'python-([0-9\.]*)(\.amd64)?\.msi', name):
try:
Expand Down
14 changes: 0 additions & 14 deletions winpython/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,10 @@
"""

import sys
# import os.path as osp
from pathlib import Path

def get_module_path(modname):
"""Return module *modname* base path"""
#return osp.abspath(
# osp.dirname(sys.modules[modname].__file__)
#)
return str(Path(sys.modules[modname].__file__).parent.resolve())


Expand All @@ -34,22 +30,12 @@ def get_module_data_path(
return datapath
else:
datapath = get_module_path(modname)
# parentdir = osp.join(datapath, osp.pardir)
parentdir = str(Path(datapath).parent)
#if osp.isfile(parentdir):
if Path(parentdir).is_file():
# Parent directory is not a directory but the 'library.zip' file:
# this is either a py2exe or a cx_Freeze distribution
#datapath = osp.abspath(
# osp.join(
# osp.join(parentdir, osp.pardir), modname
# )
#)
datapath = str((Path(parentdir).parent / modname).resolve())
if relpath is not None:
#datapath = osp.abspath(
# osp.join(datapath, relpath)
#)
datapath = str((Path(datapath) / relpath).resolve())
return datapath

Expand Down
Loading