fkie-cad / fact_helper_file

File type helper functions and magic library
GNU General Public License v3.0
4 stars 8 forks source link

Getting install to work on Windows #27

Open mahmoudimus opened 1 year ago

mahmoudimus commented 1 year ago

I don't usually use windows, but I'm doing some debugging and I wanted to install this excellent tool. To get it working, I had to modify setup.py to the following:

def run(cmd, **kwargs):
    completed = _run(["pwsh.exe", "-Command", cmd], **kwargs)
    return completed

with OperateInDirectory(MIME_DIR):
    process = run(
        '(Get-Content custom_* > custommime)'
        ' && file -C -m custommime'
        ' && Move-Item -f custommime.mgc ../bin/'
        ' && Remove-Item custommime',
        shell=True,
        stderr=STDOUT,
    )
    if process.returncode != 0:
        sys.stderr.write(f'Failed to properly compile magic file\n{process.stdout}\n')
        sys.exit(1)

and it installed.

I believe the file command-line utility must be installed separately. I already did this by just copying the pre-compiled binaries from https://github.com/nscaife/file-windows and putting them in the C:\Windows\System32 folder.

I hope this helps someone. Maybe we can put this in the README?

dorpvom commented 1 year ago

Hi mahmoudimus,

thank you for the feedback. I'll set up a way to find this information from the README. Until then, I'll just keep this Issue open.