Utilize os.path instead of pathlib
This commit is contained in:
parent
c789f779ef
commit
e8a47eeb83
11
bin/addpkg
11
bin/addpkg
@ -9,7 +9,7 @@ Functions:
|
|||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import logging
|
import logging
|
||||||
import pathlib
|
import os.path
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ syslog.addHandler(stderr_handler)
|
|||||||
|
|
||||||
|
|
||||||
# ========== Functions ==========
|
# ========== Functions ==========
|
||||||
def add_pkgfile(pkg, cachedir):
|
def add_pkgfile(pkgfile, cachedir):
|
||||||
"""Add package file to the repository directory.
|
"""Add package file to the repository directory.
|
||||||
|
|
||||||
:param pkg: path of package to add
|
:param pkg: path of package to add
|
||||||
@ -53,11 +53,8 @@ def add_pkgfile(pkg, cachedir):
|
|||||||
:param cachedir: cache directory to move package to
|
:param cachedir: cache directory to move package to
|
||||||
:type cachedir: str, bytes, or path-like object
|
:type cachedir: str, bytes, or path-like object
|
||||||
"""
|
"""
|
||||||
syslog.info(f"Adding {pkg} to {cachedir}")
|
syslog.info(f"Adding {pkgfile} to {cachedir}")
|
||||||
|
shutil.move(pkgfile, os.path.join(cachedir, os.path.basename(pkgfile)))
|
||||||
pkgpath = pathlib.Path(pkg)
|
|
||||||
cachepath = pathlib.Path(cachedir)
|
|
||||||
shutil.move(str(pkgpath), str(cachepath.joinpath(pkg.name)))
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
@ -9,6 +9,7 @@ Functions:
|
|||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import packaging_scripts.pacmanconf as pacmanconf
|
import packaging_scripts.pacmanconf as pacmanconf
|
||||||
@ -45,9 +46,9 @@ def del_pkgfile(pkg):
|
|||||||
"""Remove package file.
|
"""Remove package file.
|
||||||
|
|
||||||
:param pkg: path of package to remove
|
:param pkg: path of package to remove
|
||||||
:type pkg: pathlib.Path object
|
:type pkg: str
|
||||||
"""
|
"""
|
||||||
pkg.unlink()
|
os.remove(pkg)
|
||||||
syslog.info(f"Removed {pkg}")
|
syslog.info(f"Removed {pkg}")
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user