Skip to content

Commit

Permalink
Merge pull request #53 from CybercentreCanada/package
Browse files Browse the repository at this point in the history
pip-installable Package
  • Loading branch information
cccs-rs authored Jul 18, 2023
2 parents 92b1895 + b514752 commit cb282a8
Show file tree
Hide file tree
Showing 19 changed files with 665 additions and 167 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
build
*.egg-info
*.pyc
*.egg
cti
4 changes: 0 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +0,0 @@
[submodule "cti"]
path = cti
url = https://github.com/mitre/cti.git
shallow = true
14 changes: 0 additions & 14 deletions CCCS_YARA.yml
Original file line number Diff line number Diff line change
Expand Up @@ -284,20 +284,6 @@ vol_script:
optional: Yes
validator: None

al_configdumper:
description: "Used by Assembly Line"
format: "unvalidated"
unique: Yes
optional: Yes
validator: valid_al_config_dumper

al_configparser:
description: "Used by Assembly Line"
format: "unvalidated"
unique: Yes
optional: Yes
validator: valid_al_config_parser

al_*:
description: "Assembly Line specific metadata added for internal Assembly Line use"
format: "unvalidated"
Expand Down
1 change: 0 additions & 1 deletion cti
Submodule cti deleted from a89063
52 changes: 52 additions & 0 deletions pipelines/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: publish

trigger:
branches:
exclude:
- '*'
tags:
include: ["v*"]
pr: none

pool:
vmImage: "ubuntu-20.04"

jobs:
- job: build_and_deploy
displayName: Build and Deploy
variables:
- group: deployment-information

steps:
- task: UsePythonVersion@0
displayName: 'Use Python 3.9'
inputs:
versionSpec: '3.9'

- script: |
set -x
python -m pip install -U build
python -m build
ls dist
displayName: Build
- script: |
set -xv # Echo commands before they are run
sudo env "PATH=$PATH" python -m pip install --no-cache-dir twine
ls dist
twine upload --skip-existing --repository-url $TEST_REPOSITORY_URL dist/*
displayName: Deploy to Test PyPI
env:
TWINE_USERNAME: $(twineUsername)
TWINE_PASSWORD: $(twinePassword)
- script: |
set -xv # Echo commands before they are run
sudo env "PATH=$PATH" python -m pip install --no-cache-dir twine
ls dist
twine upload --skip-existing dist/*
displayName: Deploy to PyPI
env:
TWINE_USERNAME: $(twineUsername)
TWINE_PASSWORD: $(twinePassword)
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
clint>=0.5.1
GitPython>=3.1.0
packaging>=19.0
plyara>=2.1.1
python-baseconv>=1.2.2
Expand Down
24 changes: 24 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from setuptools import setup, find_packages

with open("README.md", "r") as fh:
long_description = fh.read()

with open('requirements.txt', 'r') as fh:
requirements = fh.readlines()

s = setup(
name="cccs-yara",
use_scm_version=True,
setup_requires=["setuptools_scm"],
description="A CCCS utility for YARA rule metadata validation",
long_description=long_description,
long_description_content_type="text/markdown",
packages=find_packages(),
install_requires=requirements,
entry_points="""
[console_scripts]
yara_validator=yara_validator.cli:main
""",
package_data={'yara_validator': ['*.yml']},
include_package_data=True,
)
Loading

0 comments on commit cb282a8

Please sign in to comment.