浏览代码

Better packaging system (fixes #32, #33):

1. Source files in "lizard" package now
2. Imports fixed to reflect this
3. lizard.py now called __init__.py
4. build.sh creates wheels
5. No more install script since it's unnecessary
master
Abrax 3 年前
父节点
当前提交
d5502623db
共有 12 个文件被更改,包括 36 次插入31 次删除
  1. 1
    6
      .gitignore
  2. 14
    5
      README.md
  3. 1
    2
      build.sh
  4. 0
    3
      install.sh
  5. 3
    1
      lizard/__init__.py
  6. 7
    7
      lizard/db_methods.py
  7. 2
    1
      lizard/db_model.py
  8. 1
    1
      lizard/file_io.py
  9. 0
    0
      lizard/json_methods.py
  10. 0
    0
      lizard/time_methods.py
  11. 5
    3
      lizard/web_methods.py
  12. 2
    2
      setup.py

+ 1
- 6
.gitignore 查看文件

@@ -1,7 +1,2 @@
.idea/*
__pycache__/*
logic/__pycache__/*
data/*
threads.db*
build/*
lizard.egg-info/*
lizard/__pycache__/*

+ 14
- 5
README.md 查看文件

@@ -6,9 +6,9 @@ Lizard is a command line (CLI) program for monitoring 8ch threads. After you add
This version will change syntax for some commands:

* Listing threads:
* `lizard la` (list all) will produce the previous `lizard l` functionality.
* `lizard l` will list only items that have had something interesting happen (reply or 404).
* `lizard rl` will print the summary list.
* `lizard la` (list all) will produce the previous `lizard l` functionality.
* `lizard l` will list only items that have had something interesting happen (reply or 404).
* `lizard rl` will print the summary list.

These changes take effect with version 0.4 so be ready to update your scripts!

@@ -20,6 +20,7 @@ This version changes syntax for some commands:
* `lizard rc` no longer a valid command
* `lizard r` does conservative refresh
* Refresh all threads: `lizard ra` instead of `lizard r`
* Changed packaging system: Now building wheels which are compatible with `pip`

### 0.2 (current)
* Help message now shows version. (issue #24)
@@ -37,10 +38,14 @@ This version changes syntax for some commands:

## Installation
### Linux

1. Download the most recent package from under `dist/`
2. Extract this into your root directory: `sudo tar -zvxf lizard-<VERSION HERE>.linux-x86_64.tar.gz -C /`

If you don't have the most recent Python3 installed and run into a problem, update your Python3 installation and try again.
2. Install with pip: `pip install lizard-0.<VERSION HERE>-py3-none-any.whl`

This will also upgrade to a newer version if you have an older version installed.

To uninstall, you can do `pip uninstall lizard`.

### Upgrading
If you've been using Lizard for a while and are upgrading to a new release, be very careful with your local data. When a new version changes the database code or how local files are stored, it could fail to read your old shit and even corrupt it. I try to note this somewhere when it happens, but I may forget or you may not see the announcement. If in doubt, backup everything (all of Lizard's data is stored under `~/lizard_data/`) before trying the new version.
@@ -55,6 +60,10 @@ If you know for sure that a version breaks backwards compatibility, you have the
### Running sources directly
You can also run the `.py` files in the repo directly. If you want to do this I'm assuming you have enough proficiency with Python to figure it out. FYI, I use PyCharm to develop so it might be easier to get it to work with it.

#### Building

`build.sh` is convenient for creating a package.

## Usage
Running `lizard` without any arguments will print the help message explaining the syntax. It will also create a `~/lizard_data` directory to store files.


+ 1
- 2
build.sh 查看文件

@@ -1,6 +1,5 @@
#! /bin/bash
python setup.py bdist
python setup.py bdist_wheel # if this fails try running pip install wheel

rm -rv build
rm -rv lizard.egg-info


+ 0
- 3
install.sh 查看文件

@@ -1,3 +0,0 @@
#! /bin/bash
sudo tar -zvxf dist/lizard-0.3.linux-x86_64.tar.gz -C /


lizard.py → lizard/__init__.py 查看文件

@@ -1,8 +1,10 @@
#!/usr/bin/env python3
import sys
import db_methods
import pkg_resources

from lizard import db_methods

version = pkg_resources.require("lizard")[0].version



db_methods.py → lizard/db_methods.py 查看文件

@@ -1,14 +1,14 @@
import os
import shutil
import webbrowser

import humanize
import db_model
import time_methods
import web_methods
from db_model import Thread
from file_io import path_to_database, ensure_directory_exists, timestamped_path_to_exported_threads_file
from json_methods import time_of_last_reply, get_oldest_reply
from web_methods import fetch_and_parse_thread_json, dump_thread_html, dump_thread_files, parse_url

from lizard import db_model, time_methods, web_methods
from lizard.db_model import Thread
from lizard.file_io import path_to_database, ensure_directory_exists, timestamped_path_to_exported_threads_file
from lizard.json_methods import time_of_last_reply
from lizard.web_methods import parse_url, fetch_and_parse_thread_json, dump_thread_html, dump_thread_files

conservative_refresh_criterion = 10


db_model.py → lizard/db_model.py 查看文件

@@ -1,5 +1,6 @@
from peewee import *
from file_io import path_to_database

from lizard.file_io import path_to_database

db = SqliteDatabase(path_to_database())


file_io.py → lizard/file_io.py 查看文件

@@ -1,7 +1,7 @@
import os
from os.path import expanduser

import time_methods
from lizard import time_methods


def save_file(file_path, file_contents):

json_methods.py → lizard/json_methods.py 查看文件


time_methods.py → lizard/time_methods.py 查看文件


web_methods.py → lizard/web_methods.py 查看文件

@@ -1,9 +1,11 @@
import json
import re
import requests
from file_io import *
from json_methods import extract_filenames

import pkg_resources
import requests
from lizard.json_methods import extract_filenames

from lizard.file_io import *

version = pkg_resources.require("lizard")[0].version
user_agent = 'Lizard v{}: https://git.teknik.io/abrax/lizard'.format(version)

+ 2
- 2
setup.py 查看文件

@@ -1,9 +1,9 @@
from setuptools import setup
from setuptools import setup, find_packages

setup(
name='lizard',
version='0.3',
packages=[''],
packages=['lizard'],
url='https://git.teknik.io/abrax/lizard',
license='MIT',
author='abrax',

正在加载...
取消
保存