1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-04 15:39:43 +00:00

update for pypi

This commit is contained in:
deadc0de6
2017-12-23 17:52:53 +01:00
parent a6633d5b1f
commit ae102749ed
11 changed files with 115 additions and 23 deletions

1
MANIFEST.in Normal file
View File

@@ -0,0 +1 @@
include README.md LICENSE requirements.txt

View File

@@ -18,7 +18,6 @@ fi
args=("$@")
cur=$(dirname "$(${rl} "${0}")")
opwd=$(pwd)
bin="${cur}/dotdrop/dotdrop.py"
cfg="${cur}/config.yaml"
# pivot
@@ -26,6 +25,6 @@ cd "${cur}" || { echo "Folder \"${cur}\" doesn't exist, aborting." && exit; }
# init the submodule
git submodule update --init --recursive
# launch dotdrop
python3 "${bin}" --cfg="${cfg}" "${args[@]}"
python3 -m dotdrop.dotdrop --cfg="${cfg}" "${args[@]}"
# pivot back
cd "${opwd}" || { echo "Folder \"${opwd}\" doesn't exist, aborting." && exit; }

View File

@@ -0,0 +1,15 @@
"""
author: deadc0de6 (https://github.com/deadc0de6)
Copyright (c) 2017, deadc0de6
"""
import sys
__version__ = '0.6'
def main():
import dotdrop.dotdrop
if dotdrop.dotdrop.main():
sys.exit(0)
sys.exit(1)

View File

@@ -5,7 +5,9 @@ Represent an action in dotdrop
"""
import subprocess
from logger import Logger
# local imports
from dotdrop.logger import Logger
class Action:

View File

@@ -6,9 +6,11 @@ config file manager
import yaml
import os
from dotfile import Dotfile
from logger import Logger
from action import Action
# local import
from dotdrop.dotfile import Dotfile
from dotdrop.logger import Logger
from dotdrop.action import Action
class Cfg:

View File

@@ -7,15 +7,17 @@ entry point
import os
import sys
import subprocess
import utils
from docopt import docopt
from logger import Logger
from templategen import Templategen
from installer import Installer
from dotfile import Dotfile
from config import Cfg
VERSION = '0.6'
# local imports
from . import __version__ as VERSION
from .logger import Logger
from .templategen import Templategen
from .installer import Installer
from .dotfile import Dotfile
from .config import Cfg
from .utils import *
CUR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
LOG = Logger()
HOSTNAME = os.uname()[1]
@@ -40,7 +42,7 @@ Usage:
Options:
--profile=<profile> Specify the profile to use [default: %s].
-c --cfg=<path> Path to the config [default: %s/config.yaml].
-c --cfg=<path> Path to the config [default: config.yaml].
--files=<files> Comma separated list of files to compare.
-n --nodiff Do not diff when installing.
-l --link Import and link.
@@ -50,7 +52,7 @@ Options:
-v --version Show version.
-h --help Show this screen.
""" % (BANNER, HOSTNAME, CUR)
""" % (BANNER, HOSTNAME)
###########################################################
# entry point
@@ -147,16 +149,16 @@ def importer(opts, conf, paths):
if opts['dry']:
LOG.dry('would run: %s' % (' '.join(cmd)))
else:
utils.run(cmd, raw=False, log=False)
run(cmd, raw=False, log=False)
cmd = ['cp', '-R', '-L', dst, srcf]
if opts['dry']:
LOG.dry('would run: %s' % (' '.join(cmd)))
if opts['link']:
LOG.dry('would symlink %s to %s' % (srcf, dst))
else:
utils.run(cmd, raw=False, log=False)
run(cmd, raw=False, log=False)
if opts['link']:
utils.remove(dst)
remove(dst)
os.symlink(srcf, dst)
if retconf:
LOG.sub('\"%s\" imported' % (path))
@@ -226,7 +228,7 @@ def main():
elif args['compare']:
# compare local dotfiles with dotfiles stored in dotdrop
tmp = utils.get_tmpdir()
tmp = get_tmpdir()
if compare(opts, conf, tmp, args['--files']):
LOG.raw('\ntemporary files available under %s' % (tmp))
else:

View File

@@ -5,8 +5,10 @@ handle the installation of dotfiles
"""
import os
import utils
from logger import Logger
# local imports
from dotdrop.logger import Logger
import dotdrop.utils as utils
class Installer:

View File

@@ -5,9 +5,11 @@ jinja2 template generator
"""
import os
import utils
from jinja2 import Environment, FileSystemLoader
# local imports
import dotdrop.utils as utils
BLOCK_START = '{%@@'
BLOCK_END = '@@%}'
VAR_START = '{{@@'

View File

@@ -7,9 +7,11 @@ utilities
import subprocess
import tempfile
import os
from logger import Logger
from shutil import rmtree
# local import
from dotdrop.logger import Logger
LOG = Logger()

11
setup.cfg Normal file
View File

@@ -0,0 +1,11 @@
[metadata]
description-file = README.md
license_file = LICENSE
[bdist_wheel]
python-tag = py3
[files]
extra_files =
LICENSE
README.md

54
setup.py Normal file
View File

@@ -0,0 +1,54 @@
from setuptools import setup, find_packages
from codecs import open
from os import path
import dotdrop
readme = 'README.md'
here = path.abspath(path.dirname(__file__))
try:
from pypandoc import convert
read_readme = lambda f: convert(f, 'rst')
except ImportError:
print('\n[WARNING] pypandoc not found, could not convert \"{}\"\n'.format(readme))
read_readme = lambda f: open(f, 'r').read()
VERSION = dotdrop.__version__
setup(
name='dotdrop',
version=VERSION,
description='Save your dotfiles once, deploy them everywhere',
long_description=read_readme(readme),
url='https://github.com/deadc0de6/dotdrop',
download_url = 'https://github.com/deadc0de6/dotdrop/archive/v'+VERSION+'.tar.gz',
author='deadc0de6',
author_email='deadc0de6@foo.bar',
license='GPLv3',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
],
keywords='dotfiles jinja2',
packages=find_packages(exclude=['tests*']),
install_requires=['docopt', 'Jinja2', 'PyYAML'],
extras_require={
'dev': ['check-manifest'],
'test': ['coverage', 'pytest', 'pytest-cov'],
},
entry_points={
'console_scripts': [
'dotdrop=dotdrop:main',
],
},
)