Skip to content

Commit 122c134

Browse files
committed
add distro as a submodule
1 parent e1b43c8 commit 122c134

File tree

4 files changed

+20
-5
lines changed

4 files changed

+20
-5
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "lib/distro"]
2+
path = lib/distro
3+
url = [email protected]:python-distro/distro.git

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@ Conditional execution of dotbot directives based on the local platform.
66
## Prerequisites
77
This plugin requires [`dotbot`](https://github.com/anishathalye/dotbot) to be installed.
88

9-
Also, at runtime this plugin requires the `distro` package to be installed. To install distro run:
10-
`pip install -U distro`
11-
129
## Installation
1310
1. Run `git submodule add https://github.com/ssbanerje/dotbot-ifplatform.git`
14-
2. Pass in the CLI argument `--plugin-dir dotbot-ifplatform` when executing the `dotbot` executable.
11+
2. Run `git submodule update --init --recursive`
12+
3. Pass in the CLI argument `--plugin-dir dotbot-ifplatform` when executing the `dotbot` executable.
1513

1614

1715
## Usage

ifplatform.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,24 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33

4-
import distro
4+
import os
5+
import sys
56
import dotbot
67
from dotbot.dispatcher import Dispatcher
78

89

10+
def _inject_distro():
11+
# Find distro in submodule
12+
root_dir = os.path.dirname(os.path.realpath(__file__))
13+
path = os.path.join(root_dir, 'lib/distro')
14+
# Update path
15+
sys.path.insert(0, path)
16+
17+
18+
_inject_distro()
19+
import distro
20+
21+
922
class IfPlatform(dotbot.Plugin):
1023
_distros = [
1124
'anylinux', # All linux

lib/distro

Submodule distro added at 116cdad

0 commit comments

Comments
 (0)