mirror of
https://github.com/lucaspalomodevelop/netbox-acls.git
synced 2026-03-12 23:27:23 +00:00
refactor setup.py for good form
This commit is contained in:
parent
b782862590
commit
141a146b68
21
setup.py
21
setup.py
@ -1,21 +1,30 @@
|
||||
"""
|
||||
Configuration for setuptools.
|
||||
"""
|
||||
import codecs
|
||||
import os.path
|
||||
|
||||
from setuptools import find_packages, setup
|
||||
|
||||
here = os.path.abspath(os.path.dirname(__file__))
|
||||
script_dir = os.path.abspath(os.path.dirname(__file__))
|
||||
|
||||
with open(os.path.join(here, "README.md"), encoding="utf-8") as fh:
|
||||
with open(os.path.join(script_dir, "README.md"), encoding="utf-8") as fh:
|
||||
long_description = fh.read()
|
||||
|
||||
|
||||
def read(rel_path):
|
||||
with codecs.open(os.path.join(here, rel_path), "r") as fp:
|
||||
def read(relative_path):
|
||||
"""
|
||||
Read a file and return its contents.
|
||||
"""
|
||||
with codecs.open(os.path.join(script_dir, relative_path), "r") as fp:
|
||||
return fp.read()
|
||||
|
||||
|
||||
def get_version(rel_path):
|
||||
for line in read(rel_path).splitlines():
|
||||
def get_version(relative_path):
|
||||
"""
|
||||
Extract the version number from a file without importing it.
|
||||
"""
|
||||
for line in read(relative_path).splitlines():
|
||||
if not line.startswith("__version__"):
|
||||
raise RuntimeError("Unable to find version string.")
|
||||
delim = '"' if '"' in line else "'"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user