Skip to content

Commit

Permalink
adding from_file to package_base for single serving usage (#39)
Browse files Browse the repository at this point in the history
* adding from_file to package_base for single serving usage
also removing deprecated argument from pypi parser and setting default
to not use user site

Signed-off-by: vsoch <vsoch@users.noreply.github.com>
  • Loading branch information
vsoch authored May 29, 2022
1 parent 1796989 commit 9fd3808
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and **Merged pull requests**. Critical items to know are:
The versions coincide with releases on pip. Only major versions will be released as tags on GitHub.

## [0.0.x](https://github.com/vsoch/citelang/tree/main) (0.0.x)
- removing deprecated pypi argument and adding from_file to package base (0.0.31)
- contrib does not count commits from other REFs, now uses git log without `--all` (0.0.30)
- Default contrib does a deep search, with option to add `--shallow` (0.0.29)
- Adding basic support for parsing CMakeLists.txt (0.0.28)
Expand Down
15 changes: 14 additions & 1 deletion citelang/main/packages/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@

# Custom package managers not in libraries IO

import sys
from citelang.logger import logger
import citelang.main.cache as cache
import citelang.main.endpoints as endpoints
import citelang.utils as utils
import requests

import os
import sys


class PackageManager:
"""
Expand Down Expand Up @@ -161,6 +163,17 @@ def package(self, name, **kwargs):
"""
return self.data.get("package")

def from_file(self, filename, **kwargs):
"""
From file reads in the filename and presents to parse.
This is a means for a specific package manager to be used directly.
We trust the user to provide the correct content file to parse.
"""
self.filename = os.path.abspath(filename)
content = utils.read_file(filename)
return self.parse(content, **kwargs)

def parse(self, content, **kwargs):
"""
Parse the self.content
Expand Down
3 changes: 1 addition & 2 deletions citelang/main/packages/pip_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,13 @@ def run(self, options, args):
session=session,
finder=finder,
use_user_site=options.use_user_site,
verbosity=self.verbosity,
)
resolver = self.make_resolver(
preparer=preparer,
finder=finder,
options=options,
wheel_cache=wheel_cache,
use_user_site=options.use_user_site,
use_user_site=False,
ignore_installed=options.ignore_installed,
ignore_requires_python=options.ignore_requires_python,
force_reinstall=options.force_reinstall,
Expand Down
2 changes: 1 addition & 1 deletion citelang/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
__copyright__ = "Copyright 2022, Vanessa Sochat"
__license__ = "MPL 2.0"

__version__ = "0.0.30"
__version__ = "0.0.31"
AUTHOR = "Vanessa Sochat"
EMAIL = "vsoch@users.noreply.github.com"
NAME = "citelang"
Expand Down

0 comments on commit 9fd3808

Please sign in to comment.